For some reason I didn't get the original post, so I'm replying to the reply.
> In a blocking socket when a network read freezes, it > is normal. It only means that nothing arrived on the > socket. > > You got to take a look at the MSN protocol. With HTTP, > it might be sending a TCP FIN or something which is > why it is working in that case... Exactly. > > after each request, I loop BIO_read until it returns > > a value <= 0. [snip] > > my case. I have > > to idea how to approach this problem. Do > > I have to use another way to see wether data is > > available to read > > from the BIO before calling BIO_read to > > prevent it from freezing? Any help would be > > appreciated. Follow the protocol. Only call 'BIO_read' if you know, based on the protocol you are using, that the other side is going to send more data (or close the connection). If the protocol is layered on top of HTTP, you can solve this just by specifying 'HTTP/1.0' and sending no 'Connection' header. This will require the server to close the connection after it sends its reply. This isn't efficient if you need to send more requests, but it does simplify things on your end. You are trying to make TCP do the job of the application. It is the application's job to figure out when it has received all the data necessary to process. So don't call 'BIO_read' in a loop until it returns an error (unless the protocol you are implementing specifies that the connection will be closed+. Call 'BIO_read' in a loop until you have enough data to process. Note that switching to non-blocking sockets won't really help you here. You still won't know whether to wait for data or to process what you have. So you'll still need to either make the server close the connection when all the data is sent or properly determine from the protocol when you have all the data (by processing a 'Content-Length' header, detecting the final close of an XML object, or some other way). DS ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]