It sounds like you've observed too things:

(1) In your previous thread, you mentioned that you had a nonblocking socket
and were getting WSAEWOULDBLOCK returned on a recv.  This means that there
was no data ready for reading.  There may have been some data just about to
arrive, but at the time of the recv call there was no data, and therefore
recv did as it should with a non-blocking socket (didn't block).

(2) Now, you are using a blocking socket and are getting 5 bytes returned by
recv, but you say that 100's of bytes were sent by the server.  This means
that only 5 bytes of the 100's have actually been received and are ready for
reading at the time of the recv call.  This is quite common and your code
needs to be able to handle this situation.  When TCP packets are sent they
are often fragmented (broken into smaller packets).  What usually occurs is
that if you do a recv after the first fragment has been received you will
only be returned that amount of data (5 bytes in your case).  If you know
that there is more data to come you should do another read which will block
until the next fragment(s) arrive.

If you don't know how much data is left to arrive, then you probably want to
go back to using a non-blocking socket, and properly handle EWOULDBLOCK (and
EAGAIN).  If you don't want to use a select call, then sleep for 100ms after
getting EWOULDBLOCK (or EAGAIN) before retrying the recv.

Regards,

Steven

> -----Original Message-----
> From: Paul Kudlawiec [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, October 27, 2000 1:56 AM
> To:   LISTSERV: Openssl-Dev (E-mail)
> Subject:      Still having recv socket problems on NT, but not Unix
> 
> Has anyone successfully implemented the ssl3_get_server_hello() method on
> NT?
> 
> We can write to an NT socket; however, we are unable to read from it. Even
> when
> I set socket to blocking mode just before a call to SSL_write(), it will
> only
> read the first five bytes out of a few hundred (the server is sending the
> correct data for the server_hello). This is not a problem for us on Unix.
> 
> Paul Kudlawiec
> Software Engineer
> Transnexus
> [EMAIL PROTECTED]
> 
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> Development Mailing List                       [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to