Search code examples
javanetwork-programmingudppacket

Packet corruption and UDP


I have to simulate a client server UDP relationship by uploading files from the client to the server. It also uses a stop and wait protocol. My question is do I need to have code in my server class to handle corrupt packets? I read somewhere online that a **

UDP packet with a checksum error will be rejected by the stack. In other words, it's not possible for a UDP packet with a checksum error to be "received at the other end correctly", because the packet will not be received at all.

**

Is that true? Would by server simply not receive the packet resulting in my client having a packet timeout?


Solution

  • UDP is a lossy protocol, it does not guarantee delivery of data. I imagine your simulation of a client server UDP relationship is a "best effort" (emulating the protocol itself) and so no, you would not need this extra code.