Hostwinds Tutorials

Search results for:


Table of Contents


What is a transport protocol?
TCP
UDP

TCP VS UDP

What is a transport protocol?
TCP
UDP

Without transport protocols such as TCP (Transmission Control Protocol) and UDP (User Datagram Protocol), data sent over the network with no regard for how a host handles the incoming data packets would be impossible to handle. That is where the Transport layer (Layer 4 on the OSI Model) comes into play. It serves as the interface between the lower level Network layer (Layer 3 in the OSI Model) and the high-level Application layer (Layer 7 in the OSI Model).

What is a transport protocol?

There are a few protocols in the TCP/IP suite, including the titular TCP and UDP protocols. At its core, the transport protocol carries data between the network and specific ports. These ports are available for use in higher-level applications.

TCP

TCP is the most used transport protocol for email, web traffic, and file transfer applications such as FTP. The main advantages of TCP are that  it is :

  • Connection-oriented: TCP ensures a two-way connection between hosts, even if it is only for one-way data flow.
  • Reliable: TCP ensures that all data arrives at the intended target host. If any of the data does not arrive, TCP will handle the errors and attempt to resend.
  • Error correction: a TCP segment contains something called a checksum used to detect discrepancies between the segments sent and the segments received. TCP will detect corrupt segments and attempt to resend them just like with missing segments.
  • Flow control: The receiving host can regulate data flow to keep slower hosts from getting bogged down by a host sending data much faster than it can receive.
  • Sequencing: TCP ensures that packets will be sent to higher layers in the correct order, even if they came across the network out of order.

UDP

While TCP has to make it a good choice for network traffic, all of the extra error checking and handling makes the packets larger and increases the processing load to accomplish the task.

UDP is essentially the opposite of TCP in how it behaves. It is unreliable, connectionless, fast, and lightweight. The local host sends diagrams to the remote host and does not wait for any connection to be set up or any acknowledgment from the remote host. This makes it an unpopular choice compared to TCP, but UDP is the perfect protocol in some cases.

Streaming services and game servers are prime examples of times when a fast connection is essential and when error checking on each packet with TCP could cause more of a hang-up than a corrupt packet sent with UDP.

Written by Hostwinds Team  /  June 5, 2021

Need help? Chat now!