I am trying to receive an HTTP response from a web server using NetLibReceive and am trying to figure out how to tell when and if all of the data has been received.
My understanding is that you should repeatedly call NetLibReceive, passing it a buffer and retrieving the received data from that buffer as NetLibReceive returns the number of bytes received into the buffer. When no more bytes are received, NetLibReceive should return 0, however that is not what I am seeing. I have yet to get a 0 result, and instead always get a -1 and timeout error signaled after having to wait for the timeout. For example: if the "number of bytes read" returned by the last call to NetLibReceive is less than the buffer size, how can you know for sure that the sender is not still sending data. I.e. ideally you should make one more call to NetLibReceive and expect to get a 0 back if the sender is done. However, doing this causes a full timeout delay and only raises a timeout error, which makes you have to guess whether this is a real timeout and the sender wasn't able to complete the transfer OR that the sender was indeed finished and shut down the connection. How is this typically handled? -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
