Pages

Saturday, April 15, 2017

Difference Between TCP and UDP

The essential difference is that UDP is "fire and forget" (and like a bullet, if it misses it doesn't tell you...) - there's no acknowledgement of UDP traffic from the receiver built into the protocol, no flow-control, error-correction or windowing (packet segmentation/sequencing/reassembly/size-negotiation) - all these are parts of the TCP protocol specification, there are clues in the names - User Datagram Protocol (like a telegram, you send it and *may* get a reply depending on what the destination does but no guarantee) and Transmission Control Protocol (like a phone call, there's an end-to-end transmission path in both directions and negotiations between end-points, it's "connection oriented" where UDP is "connectionless").



Much of the activity in a TCP connection is needed because of the non-deterministic, unreliable nature of the Datalink layer - much of Ethernet has been handed down from the Alohanet (networking over a single radio channel with collision avoidance by carrier sensing), and until the advent of store-and-forward switches and routers there was no guarantee of delivery. Things are better now, but UDP is still an inferior choice if reliability matters! 

Image2001.gif

Handshake SYN, SYN-ACK, ACK No handshake (connectionless protocol)
Header SizeTCP header size is 20 bytesUDP Header size is 8 bytes.


UDP packets can not be greater then 512 bytes.

No comments:

Post a Comment