Reading a Socket With the Recv() Function
When using Internet sockets, the recv() function has the form:
ssize_t recv(int socket, void *buffer, size_t length, int flags). I am concerned about what happens if a single read brings in more data than the size of the buffer. I know that for UDP sockets, any data in excess of the length parameter will be discarded. I cannot find a straight answer to the question of what happens for TCP sockets when more data arrives than the buffer length. Does anyone know? Thanks! |
It's like reading a file. The remaining data is still present awaiting your next read()/recv().
|
Good, then it won't overflow the buffer if the length parameter has been given correctly. Thank you.
|
All times are GMT -5. The time now is 08:09 AM. |