From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Trenton D. Adams" To: "'Grant Edwards'" Cc: "'Jonathan Larmour'" , "'eCos Discussion'" , "'Gary Thomas'" Subject: RE: [ECOS] TCP/IP Stack packet regrouping Date: Mon, 16 Jul 2001 14:44:00 -0000 Message-id: <000801c10e40$84c95f50$090110ac@TRENT> References: <20010716162741.A11222@visi.com> X-SW-Source: 2001-07/msg00493.html > On Mon, Jul 16, 2001 at 02:33:31PM -0600, Trenton D. Adams wrote: > > > > > > > If not, in blocking mode it will most likely appear > to happen > > > > all at one time right? > > > > > > Not necessarily. read() can return early if _some_ data is > > > available. > > > > Are you saying that read () will return if ONLY some of > the data is > > there, but will complete successfully if it's all there? > > When you call read in blocking mode, it will return "n" when > 1) there is some data available: n>0 > 2) there is an error: n<0 > 3) the connection has been closed: n==0 > > > So, to summarize what you said. > > > > Sending generally will send it all at once, and there's > no need for a > > loop for the outgoing buffer? > > No, that is not generally true. For small blocks, it will > _usually_ be true. For large blocks of data, you will have > to check the return value from write() in a loop. The > values of "small" and "large" vary from platform to platform. > Ok, who's actually correct here? Who's the one that wrote the TCP/IP stack? Are they listening? > > Receiving I should always do the loop just in case? > > Yes -- for both read and write. > I'm reading the Linux documentation on send (), and it says that a send () call will block if "the message does not fit into the send buffer of the socket". Which tells me it that it is sending the information all at once (from the programmer's perspective). It also says that if it's to big to pass through the underlying protocol, it will return with an error of EMSGSIZE. Is this correct or not? >> No, that is not generally true. For small blocks, it will _usually_ >> be true. For large blocks of data, you will have to check the return >> value from write() in a loop. The values of "small" and "large" vary >> from platform to platform. > Oops, yes you're right. I misremembered from the top of my head evidently. > >Jifl Did you actually misremember, or am I now screwing with your head? LOL How do I find out what the maximum message size is?