This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: TCP/IP Stack packet regrouping
- To: "Trenton D. Adams" <tadams at extremeeng dot com>
- Subject: Re: [ECOS] TCP/IP Stack packet regrouping
- From: Grant Edwards <grante at visi dot com>
- Date: Mon, 16 Jul 2001 16:27:42 -0500
- Cc: 'Jonathan Larmour' <jlarmour at redhat dot com>,'eCos Discussion' <ecos-discuss at sourceware dot cygnus dot com>
- References: <3B534C75.74C3B203@redhat.com> <000201c10e36$941324f0$090110ac@TRENT>
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.
> Receiving I should always do the loop just in case?
Yes -- for both read and write.
--
Grant Edwards
grante@visi.com