Thanks David.

Unfortunately option 1) and 3) are not possible for my clients.

option 2) seems the way to go for me, but so far it proved unreliable. Here
are some scenarios I have been playing with:

1)Crash a client running on unix:

The SSL_read returns 0 . The SSL error code is SSL_ERROR_SYSCALL [An SSL I/O
error occurred]. The errno is 0!

2)Crash a client running on windows:

The SSL_read returns -1 . The SSL error code is SSL_ERROR_SYSCALL [An SSL
I/O error occurred]. The errno is ECONNRESET [Connection reset by peer]

3)Leave the client running on unix or on windows and unplug the network:

The SSL_read returns -1 . The SSL error code is SSL_ERROR_SYSCALL [An SSL
I/O error occurred]. The errno is ECONNRESET [Connection reset by peer]


As you can see this does not seem to be reliable to distinguish between what
really happened.

Thank you for any other ideas.

On Tue, Nov 4, 2008 at 4:55 PM, David Schwartz wrote:

>
> Md Lazreg wrote:
>
> > Actually the same question is valid even if I am not using SSL sockets.
> > So is there a way to distinguish between if a socket was closed because
> > of a client crash or because of a netwrok issue?. If yes, is there an
> > equivalent under SSL sockets?

>
> You have three choices:
>
> 1) Always assume the client might return. Delay returning resources for a
> reasonable amount of time.
>
> 2) Guess based on the error code. For ECONNRESET, assume the client might
> come back. For ETIMEDOUT, assume it won't. For an apparently normal close
> (but at an unexpected time), assume it crashed. You'll be right some
> fraction of the time, depending on what types of errors happen.
>
> 3) Code a reliable method to tell. For example, code a way to probe if the
> client machine is still around (perhaps a separate daemon to report
> presence
> or report the crash of the client program). Code a proxy on the client
> (that
> is reliable enough to 'almost never' crash) that can report the loss of the
> other end of the proxy (the real client program) or similarly engineer a
> solution.
>
> DS
>
>
> __________________________________________________ ____________________
> OpenSSL Project http://www.openssl.org
> User Support Mailing List openssl-users@openssl.org
> Automated List Manager majordomo@openssl.org
>