648 views

1 Answer

0 votes
0 votes

why do we need UDP when we could just send IP packets with the same payload?

  1. IP packets have no end-to-end error detection mechanism. IPv4 has a checksum that covers only its header, so the data is protected only by the layer 2 error detection, which isn't end-to-end. Both UDP and TCP use a checksum to check the data for errors end-to-end.

  2. Once the destination machine receives such an IP packet, which application should it pass it to? We need a way of identifying the destination app (socket actually, but never mind) of a specific message. UDP and TCP do that with port numbers. Having no port number is similar to sending a postal package to an apartment building without specifying which apartment it should be given to.

Ref: https://stackoverflow.com/questions/47167068/why-does-udp-exist-whats-wrong-with-letting-the-user-send-raw-ip-packets

Related questions

1 votes
1 votes
1 answer
4