Evgeniy Berezovsky
Evgeniy Berezovsky

Reputation: 19258

Will Socket deliver IP fragmented packets as one reassembled UDP packet?

When receiving TCP packets, Socket will give me reassembled packets, in case they got IP fragmented, as I'm guaranteed to get an ordered, gap-free stream of bytes.

When receiving UDP packets, where I may receive packets in a different order than sent, or duplicates, and other packets might get lost along the way, I would have expected to get every UDP/IP packet "raw", immediately when it arrives. On the other hand, as I don't get the IP header, I could not reassemble packets myself. In other words, I have to rely on Socket to do the job for me. But that would mean, that for this reassembling alone, (fragmented) packets would have to be buffered, ordered, de-duped, and discarded if a fragment doesn't make it.

How does this work in reality?

Upvotes: 3

Views: 2163

Answers (1)

Ananke
Ananke

Reputation: 1230

Reassembly occurs at the IP layer, and is transparent to you. In short you don't need to be concerned about it, other than for performance reasons, unless you are splitting up the packets yourself.

Upvotes: 3

Related Questions