Summary
TCP has advantages over UCP. TCP is more robust, with packet tracking and retransmittal built right into the transport layer. The application never needs to worry about whether a packet arrives and in what order. The sender and receiver send and receive data on the socket as they read and write data to a file.
UDP has advantages over TCP. UDP is faster, more lightweight, and all-around cheaper. It is best used in situations where reliability is not an issue, otherwise the application has to implement the reliability. It excels in low-bandwidth situations because of the low overhead imposed by UDP. Conserving network resources is always good.
Programming UDP sockets is not really that much harder than TCP. They are easy to use for the purposes for which they were designed: broadcasting data and simple protocols. It would be difficult to implement an FTP server, but implementing the Daytime Protocol is so simple we were able to implement both a client and server.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access