On Thu, 14 May 1998, Louis-David Mitterrand wrote:
> To implement a socket I copied the init_client() method from s_client.c.
> What is the best way to check for and deal with socket errors? Should I
> pass the socket to the BIO library and let it deal with error-checking?
I mean to rewrite all the s_client/s_server etc stuff in the apps directory to
use the BIO stuff :-).
Probably the best way would be to use the BIO abstraction. All calls then
return the number of bytes for sucess, 0 for closed connection and
-1 for an error. The BIO_sock_should_retry(int code) function, when handed
the result from a read/write/send/recv on a socket will return 1 if the error
code was due to a non-blocking condition. 0 if the error is fatal.
Depending on the box, the errors I check for as non-fatal are
EWOULDBLOCK /* Normal non-blocking error */
ENOTCONN /* non-blocking connect error */
EINTR /* Interupted system call */
EAGAIN /* A 'Try again' error :-) */
EPROTO /* This tends to be a solaris transitory error */
EINPROGRESS /* Stop hasseling me to finish :-) */
EALREADY /* Same as EINPROGRESS */
eric
+-------------------------------------------------------------------------+
| Administrative requests should be sent to [EMAIL PROTECTED] |
| List service provided by Open Software Associates, http://www.osa.com/ |
+-------------------------------------------------------------------------+