Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!sun-barr!lll-winken!cert!netnews.upenn.edu!netnews!mjd From: mjd@saul.cis.upenn.edu (Mark-Jason Dominus) Newsgroups: comp.unix.questions Subject: Do send(2) and recv(2) always send and receive complete messages? Message-ID: Date: 9 May 91 20:48:11 GMT Sender: news@netnews.upenn.edu Distribution: comp Organization: University of Pennsylvania Lines: 24 Nntp-Posting-Host: saul.cis.upenn.edu 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@central.cis.upenn.edu