Hi all,

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
libc_lwip_loopback plugin.

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 [1].

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
this issue?

Thanks!

Cheers,
Alex

[1] 
https://github.com/senier/componolit/blob/issue16/src/test/mfe/writev_socket_short/main.cc

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main

Reply via email to