On 8/11/05, David Schwartz <[EMAIL PROTECTED]> wrote: <snip>
> > My code uses blocking sockets, has the SSL_CTX > > SSL_MODE_ENABLE_PARTIAL_WRITE option set and loops on the ssl_read but > > the socket is closed after the first 32k is sent. > > > > Why, if a message block size is 16k, does the first 32k of a message > > get written/read, then the socket dropped? <snip> > Give us example code or more detailed information about what you mean > by > "the socket dropped" and how you determined that. > My bet is simply that there's a bug in your code. With non-blocking > sockets, you have to test the return value of SSL_read and properly handle > partial or failed sends. You may get a failed send if there was insufficient > space to fit a single block of protocol data (or if protocol data was sent > that corresponds to zero bytes of application data!). You may get a partial > send. Thanks for your reply David - I think you're probably right about my code! ;-) Upon your suggestion I added some more cases to test the return code of ssl_write and found that I am getting a SSL_ERROR_SYSCALL after the first 32 bytes. Here is is the code. As mentioned before, I have the SSL_CTX set with partial writes enabled, the main write loop is as follows (for clarity,I've removed all the tests of ssl_write other than those that get called). --start------------ char error_str[BUFF_SIZE] char out_buf[BUFFSIZE]; int sent_bytes=0; int offset=0; int bytes_to_send = <length of data in out_buf> fprintf(stderr, "- Attempting to write %d bytes\n", bytes_to_send); while(bytes_to_send){ sent_bytes = SSL_write(p_ssl, out_buf+offset, bytes_to_send); switch(SSL_get_error(p_ssl, sent_bytes)) { case SSL_ERROR_NONE: bytes_to_send -= sent_bytes; offset += sent_bytes; fprintf(stderr, "- Written %d bytes\n", sent_bytes); break; case SSL_ERROR_SYSCALL: error_str = Err_error_string(Err_get_error()); fprintf(stderr, "- SSL_ERROR_SYSCALL: %s\n", error_str); return false; // exit routine default: fprintf(stderr, "- SSL_write reports %d\n", sent_bytes); return false; // exit routine } } --end-------------- When I try and write more than 32k I get the following messages... - Attempting to write 59266 bytes - Written 16384 bytes - Written 16384 bytes - SSL_ERROR_SYSCALL: error:00000000:lib(0):func(0):reason(0) I have SSL_load_error_strings() earlier in my code, but don't get any more information than this. I'm still at a loss as to whats happening here, but many thanks for your help in getting this far. Michael. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]