Re: Sockets: How to force recv of unknown data size (all data)

From: Lew Pitcher (Lew.Pitcher_at_td.com)
Date: 01/12/04


Date: Mon, 12 Jan 2004 20:20:41 GMT

On 12 Jan 2004 19:41:31 GMT, Casper H.S. *** <Casper.***@Sun.COM> wrote:

>"Marcio Calixto Cabral" <mcabral@lsi.usp.br> writes:
>
>>- Can I force the recv command to receive all data that was sent? Since it
>>is a variable size, I cannot use MSG_WAITALL flag. Also, the frames are over
>>64k, which means they are bigger than the maximum block size allowed. Does
>>this mean the packet gets splitted into two sends?
>
>You'll need to coalesce; tcp will typically fragment in 1500 byte
>packets

Let's rephrase this, shall we?

TCP will typically fragment in MSS-sized packets

FWIW, 1500 bytes is typical of ethernet, but not so typical of (say) a low speed
ppp connection, or even a 16Mb token ring connection. Don't depend on 1500-byte
fragments.

> so it is not unlikely that your application will only read
>1500 bytes at a time.
>
>Casper
>--
>Expressed in this posting are my opinions. They are in no way related
>to opinions held by my employer, Sun Microsystems.
>Statements on Sun products included here are not gospel and may
>be fiction rather than truth.

-- 
Lew Pitcher
IT Consultant, Enterprise Technology Solutions
Toronto Dominion Bank Financial Group
(Opinions expressed are my own, not my employers')