I have what I hope to be a relatively simple question regarding SSL_read/write/etc operations on nonblocking sockets, and the errors they return. I would like to preface this by saying that I have spent hours scouring google and also searching the archives and I haven't really found an answer, so please don't flame me!

With that said -

I'm setting up my sockets to be nonblocking, and then doing the following to set up my ssl objects (relevant code only):
toClientSSL = SSL_new(ctx);
toClientBIO = BIO_new_socket(inSock, BIO_CLOSE); // inSock is nonblocking
       SSL_set_bio(toClientSSL, toClientBIO, toClientBIO);

Sometimes a SSL_read() operation on toClientSSL will return <0, and SSL_get_error yields SSL_ERROR_SYSCALL, and if I look at errno (from <errno.h>) it's set to EWOULDBLOCK. I had thought that if something was going to block, SSL_get_error would return either SSL_ERROR_WANT_READ or _WRITE. I was handling those two errors, but I was just assuming that SSL_ERROR_SYSCALL would only come up for things like premature closing of the socket, and other similar rather fatal errors. Is this the correct behavior (that it's reported as SYSCALL rather than _WANT_READ etc...)?

Thanks in advance, and I'm sorry if this seems like a trivial question, but I honestly have been looking all over for an answer.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to