Do send(2) and recv(2) always send and receive complete messages?

Mark-Jason Dominus mjd at saul.cis.upenn.edu
Fri May 10 06:48:11 AEST 1991


I am programming under SunOS 4.1.1.

    If I try to read a 256-byte message with `recv', can `recv' return
without having read all 256 bytes, the way `read' can?  Or is `recv'
guaranteed to block until 256 bytes of data arrive?  The man page for
`socket(2)' seems to imply the former, but I'm not sure.

    If I use `send' to send a 256-byte message, will the entire message
necessarily be sent as a single packet?  If I am using UDP with the
SOCK_DGRAM abstraction, and I send a 256-byte message, I know I should
expect to deal with lost packets.  Will a lost packet necessarily
contain an entire message, or is it possible to lose part of a single
message due to a dropped packet?

    The man page suggests that messages sent with `send' will be sent as
single datagrams, as long as they are sufficiently short.  How short
must they be?


--

   Nihil tam absurde dici potest, quod non dicatur ab aliquo philosophorum.
Mark-Jason Dominus 	  			    mjd at central.cis.upenn.edu 



More information about the Comp.unix.questions mailing list