Hi,
When using recv if the len parameter is shorter than the data in the buffer the remaining data is discarded. This seems strange to me, I thought I was reading from a stream? Is there anyway to read a fixed number of bytes and not loose the rest?
I know I can create my own buffer to read data from recv into and then go through the data in my buffer in pieces. But now recv takes data from some internal buffer, I read it into my own buffer, then look at pieces of that and divide them into their own buffers for processing. Isn't that at least one buffer too many? And I'll need a buffer for each client, which will start to eat up a lot of memory.
If I have to make my own buffer, how big does it need to be so that I don't loose data when calling recv?
Thanks!
When using recv if the len parameter is shorter than the data in the buffer the remaining data is discarded. This seems strange to me, I thought I was reading from a stream? Is there anyway to read a fixed number of bytes and not loose the rest?
I know I can create my own buffer to read data from recv into and then go through the data in my buffer in pieces. But now recv takes data from some internal buffer, I read it into my own buffer, then look at pieces of that and divide them into their own buffers for processing. Isn't that at least one buffer too many? And I'll need a buffer for each client, which will start to eat up a lot of memory.
If I have to make my own buffer, how big does it need to be so that I don't loose data when calling recv?
Thanks!