Re: [GD-General] UDP questions
Brought to you by:
vexxed72
From: Mads B. D. <ma...@ch...> - 2002-06-30 19:35:23
|
On Sat, 29 Jun 2002, Brian Hook wrote: > I'm working on a basic UDP implementation right now and I'm running into > conflicting information on packet fragmentation. What are your sources? > > My understanding of UDP is that it's unreliable, unguaranteed, and > basically not going to get you data in any particular order or even at all. Same here. > Fine, I can deal with that. > > BUT, if it DOES get you data, that data is supposed to be "complete". In > other words, if Server sends a packet of 500 bytes to Client, then Client > will either receive that packet or none at all when it calls recv() > (assuming that the recv() buffer is large enough). Yes? That is my understanding: the fragmentation you are worrying about is on the IP level, ie, the UDP packet _might_ be fragmented into several IP packets. The IP layer should handle this, iff all packets arrive. If not, you loose the UDP packet. > If I get get a positive return value from recvfrom(), can I assume that > it's a single complete packet? For UDP, yes, this is my understanding. > Is it possible that I'll receive multiple > packets in a single call to recvfrom()? Is it possible to receive a > partial packet? Don't think so. > I know that send() can deliver less than the number of bytes you request, > but that's easy enough to handle. I am unsure how send() works with UDP packets. I would assume that it is ready to handle all valid UDP packet sizes. Mads -- Mads Bondo Dydensborg. ma...@ch... On the other hand, we can agree with Microsoft that the GPL is bad for their current business. We can then proceed to use Microsoft's favorite word as we reply: Innovation won't stop just because you're not ready for it. The printing press was a good thing, after all, even though it forced professional scribes to change their business model. Adapt or die - Chip Salzenberg |