TCP
|
UDP
|
TCP stands for “Transmission Control Protocol”. It is the most commonly used Internet Protocol. |
UDP stands for “User Datagram Protocol” or “Universal Datagram Protocol”. |
This protocol is connection- oriented.Connection-oriented means first an end- to-end connection is established between the devices at the two endpoints before the transmission of data. |
This protocol is connectionless. This means that without having a prearranged channel, each data unit of information is addressed and routed individually based on the information it carries. |
TCP adopts a method called as “Flow Control”. It determines when there is a need to re-send the data. Also, it stops the data flow until successful delivery of previously transferred data. |
No flow control is there in UDP.It is suited for multicasting and packet broadcasts. |
Collision may take place when a packet of data is transferred. TCP provides “error correction”. In case of a collision, a request can be initiated by the client to the server to re-send the data until the whole data segment is received completely. |
No such form of error correction is offered by UDP. The packets transferred using UDP can get affected by collisions. Only error-checking is there but no recovery method. |
The speed observed by TCP is slower when compared to that of UDP. |
UDP is only cares for speed. It is faster than TCP as there are no provisions of flow control or error correction. |
Rearrangement of data packets is done in TCP. Hence the packets are guaranteed to be in a specific order. |
There is no intrinsic order of packets in UDP. All packets are independent of one another.If arrangement of data packets in a specific order is required, then it has to be handled in the Application layer. |
The packets that are transferred using TCP are delivered without any tampering and in the same order as they were sent. This is guaranteed in TCP.Hence, TCP is a reliable protocol. |
On the other hand, in case of UDP,It cannot be made sure if the data packets are going to reach the destination on the first place.UDP is non-reliable. |
The header size in case of TCP is 20 bytes. Header fields include Source Port, Destination Port, and Checksum. Few unique header fields are Sequence Number, Data Offset, Ack number etc. |
The header size in case of UDP is 8 bytes. Few header fields are Length, Source Port, Destination Port, and Checksum. |
It is established by a three way handshake. A connection is initiated and acknowledged using SYN, SYN-ACK and ACK signals. |
UDP is a connectionless protocol hence no handshake is required. This is the reason there is no guaranteed reliability or ordering of packets/messages. |
Because of using handshake to establish a connection, TCP is heavy-weight. |
UDP is lightweight. Basically, UDP is a small lightweight transport layer which is designed on the top of Internet Protocol. |
In TCP, the data is read as a byte stream. In order to segment the boundaries, messages are sent. |
UDP packets have defined boundaries.Packets are sent individually. |
Other protocols that use TCP are HTTP, HTTPs, FTP, SMTP, and Telnet. |
Other protocols that use UDP are DCHP, DNS, TFTP, SNMP, RIP, and VOIP. |
For transferring important information, TCP is preferred. It is best suited for applications in which transmission time is not strictly defined and high reliability needs to be assured. |
UDP is never used to send critical or important information. It is best suited for applications in which fast transmission is needed but reliability is not a concern, for example in games.In case a server needs to reply to a large number of clients, UDP is used. |