Re: What causes a recv syscall for a socket to sometimes return less than the request len?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 21, 2016 at 05:20:30PM -0700, Daniel Ellis wrote:
> I've changed the underlying code to correctly call recv until all the data
> has been received, but I am curious as to what's going on under the hood
> that made this so sporadic (and a bit of a headache to track down).  Any
> help would be appreciated!

Splitting and merging of chunks may happen anywhere in the pipeline
between sending and receiving _applications_. Networking stacks of
operation systems of endpoints, as well as of intermediate nodes, are
free to do whatever they decide with these chunk boundaries, because
these boundaries are not part of TCP connection user interface. Again,
it is by design that you cannot rely on these boundaries. Just always
read up to complete message if you are using TCP, or use something other
than TCP - for example, UDP seems to preserve boundaries (however there
is even more headache with UDP).

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux