Read all data from socket, vs. a subset
Sockets are not guaranteed to provide all the data that is requested in a recv. From the documentation: If no messages are available at the socket, the receive calls wait for a message to arrive, unless the socket is nonblocking (see fcntl(2)), in which case the value -1 is returned and errno is set to EAGAIN or EWOULDBLOCK. The receive calls normally return any data available, up to the requested amount, rather than waiting for receipt of the full amount requested. We now add a function that retrieves all requested data from a read, looping until the whole requested buffer can be filled. The sockets are blocking and configured with a timeout, so the receive can still exit if needed. Bug: 194106305 Test: gd/cert/run Change-Id: I26f8025bc377a8d323df0ba81329730dc4a9c6f6
Loading
Please register or sign in to comment