Re: UDP packets

Giganews Newsgroups
Subject: Re: UDP packets
Posted by:  Remy Lebeau \(Indy Team\) (no.spam@no.spam.com)
Date: Fri, 21 Sep 2007

"Malcolm Smith" <nospam@nospam.com> wrote in message
news:42F62C334A36E340nospam@nospam.com...

> is it true to say there is a potential for the data to arrive at the
> client in the wrong order (I'm sending data over the internet).
> ie, 4 calls 1, 2, 3, 4 may be received as 2, 4, 3, 1 ?

Yes.  That is one of the pitfalls of UDP (the other is that packets may not
arrive at all).  The receiver will have to re-order the packets on its end
after they have been received.  So you should include some kind of counter
in your packet data so the receiver knows when reordering is needed, and to
detect when packets are missing.

> can I also assume that any data sent (in a single call to SendTo)
> will either be received in full (possibly corrupt), or not at all.

Yes.

Gambit

Replies

None

In response to

UDP packets posted by Malcolm Smith on Fri, 21 Sep 2007