Receiving message written by writev() in multiple chunks
alex at ...331...
Thu Aug 3 17:21:31 CEST 2017
when using writev() on a TCP socket, I get a behavior that is unexpected, although it may OK by the specification. My test program is using the
I create a TCP socket, bind it so some address/port and put it into listening mode. Then, I create another socket, connect to that port and
write and IOVEC referencing 3 buffers using writev(). The buffers have a total length of 17 which is returned as a length by the writev().
When reading from the socket using recv(), I'd expect it to return 17 bytes with are identical with the content of the IOVEC. Instead, I need to
perform two recv() calls, the first returning the first buffer of the IOVEC and the second returning the buffers 2 and 3 of the IOVEC concatenated.
Find example code here .
As I said, this may be perfectly legal behavior. OTOH, Linux and Android behave as expected and there may be code relying on it. Any thoughts on
More information about the users