What is TCP?

Transmission Control Protocol (TCP) is mostly used for internet Protocols once the connection is established. TCP/IP is used to send and receive data transmitted from the network and determines the data flow of the packets.

TCP is specifically designed to offer reliable and guaranteed data delivery to the destination router with an extensive error checking mechanism. TCP uses 3-way handshake methods for data transfer, which we will see in more detail further.

TCP mechanism

TCP uses 3 Way handshake methods for data transmission, i.e. once the connection is established between the network nodes, TCP acknowledges the packets sent to the destination address with SYN flag, and at the other end of the node after receiving the packet from the source address will acknowledge with ACK flag. Finally, after the communication is terminated between the nodes the SYN-ACK flags communicate with flags reset or FIN (i.e., Ending the connections as it’s been terminated let us connect with a new session again starting with SYN Flag).

Figure: Host A is asking Host B, hey if you’re alive I need to send some packets to you with SYN Flag. Host B responds to Host A with SYN-ACK Flag, yes I’m ready to connect with you for the data receiving. So at last the Host A sends the ACK Flag to Host B to confirm that I’m also ready to send the data and let’s connect it. And finally, the connection is established between the Client (Host A) and Server (Host B) and data transmission happen in TCP.

Features of TCP:

  • Packet acknowledgment for Delivery.
  • Checking Error for packets and resending if there is an error.
  • Maybe a delay in data transmission when the network traffic is abnormal.
  • Sequencing of data in order, means the packets arrive at the receiver.

Examples of TCP:

HTTP, FTP, SMTP, POP3, are commonly used internet applications protocols use TCP.

What is UDP?

User Datagram Protocol (UDP) is mostly used for broadcasting and multicasting the network data transmission. UDP works similar to TCP other than checking for errors in data and it doesn’t use 3 way method as TCP.

UDP Mechanism

UDP doesn’t worry about data reliability and or integrity. And it works without implementing the 3 Way handshaking rather uses a simple data transmission.

Figure: Here, the sender just the data to the receiver without knowing whether it’s ready to receive the data or not. Whereas in the receiver it might be ready to accept and sometimes it’s not online to accept the data packets from the sender as they don’t acknowledge each other as TCP. UDP is a connectionless transfer protocol hence this is the way UDP sends and receives data which may prone to packets errors.

Features of UDP:

  • UDP sends data in a bulk quantity of packets.
  • There is a possibility of Data loss during the transmission.
  • No delay in data transmission.

Examples of UDP:

DHCP, DNS, Online Multi-player games, VOIP, TFTP (Trivial File Transfer Protocol), RIP (Routing Information Protocol).  

TCP VS UDP

TCP

  • Transmission Control Protocol.
  • TCP Connection-Oriented Protocol.
  • TCP is a heavy-weight Protocol.
  • TCP doesn’t support broadcasting and multicasting. Data Retransmission is possible in TCP.
  • Data sequencing is a feature is available in TCP, which means sending the packets in sequential Orders.
  • TCP header size is 20 bytes.
  • 3 Way handshake (SYN, SYN-ACK, ACK) and acknowledge the packets.

UDP

  • User Datagram Protocol.
  • UDP Connection-less protocol.
  • UDP is a light weight Protocol.
  • UDP supports Broadcasting.
  • UDP doesn’t support data retransmission.
  • UDP do not have data sequence, it has to be managed only by the application layer.
  • UDP header size is 8 bytes.
  • No handshake it’s a connectionless protocol. Hence no acknowledge of packets.

Advantages of TCP

  • Helps in establishing the network communication between the computers.
  • TCP can be operated independently on the OS.
  • TCP supports many routing protocols.
  • TCP has a client-server architecture

Advantages of UDP

  • Broadcast and multicast are available for UDP.
  • UDP never supports connection-based communication which makes it easier and the data transfer rate is faster than TCP.
  • Data loss can be made in case the network bandwidth is slowed or dropped.

Disadvantage of TCP

  • TCP never sends the data packets until the complete connection is established.
  • TCP can be used for broadcasting and multicasting which makes it a slower protocol.
  • As it may waste bandwidth, time, effort since TCP offers multiple features which are sometimes not required.
  • For example: In case online multiplayer games cannot accept the TCP as its works on Client-Server architecture, as it does not support broadcasting or multicasting.

Disadvantage of UDP

  • Data retransfer is not possible if the packets collide and the packet may not be resent or delivered twice.
  • UDP is likely to suffer from huge data loss and it doesn’t check for packet error and sequencing.
  • No Flow control or order of packets sending features available to check if data integrity and reliability.
  • For Example, UDP is useful while playing online multi-player as it supports broadcasting which connects to multiple users and different networks. Broadcasting which connects to multiple user and different networks.

By Michael

Writer of Infohaunt is an Cyber Security Professional have experience in SOC operations, Threat Management, Incident Response, Threat Hunting, Digital Forensics.