Embedded Ethernet and Internet Complete: Designing and Programming Small Devices for Networking

This section explains how UDP and TCP help get data to its destination. Knowing more about how the protocols work can help in selecting which protocol to use and in using the protocol effectively. Also included is a review of options for obtaining code to support UDP, TCP, and IP in embedded systems.
The Ethernet standard specifies a way to transfer information between computers in a local network. But Ethernet alone doesn t provide some things that many data transfers require. These include naming the port, or process, that is sending the data, naming the port that will use the data at the destination, handshaking to inform the source whether the destination received the data, flow control to help data get to its destination quickly and reliably, and sequence numbering to ensure that the destination knows the correct order for messages that arrive in multiple segments. The transmission control protocol (TCP) can provide all of these. The user datagram protocol (UDP) is a simpler alternative for data transfers that only require specifying of ports or error checking. Table 5-1 compares UDP and TCP.
| Protocol | UDP | TCP |
|---|---|---|
| Name of unit transmitted | datagram | segment |
| Source port specified to remote host? | optional | required |
| Must establish a connection before transferring data? | no | yes |
| Supports error checking? | optional | required |
| Supports flow control? | no | yes |
| Supports handshaking? | no | yes |
| Supports sequence numbering? |