TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are two protocols that run on the forth layer of OSI layers. There are many advantages of using TCP over UDP. TCP as we know is a connection based protocol, meaning that a connection needs to be setup before the transfer of data can start. To be able to do that TCP has been designed with the 3-way handshake system. In this system a user who wants to send data initializes the connection and is acknowledged by the receiving end. Once acknowledged, the sender acknowledges the Acknowledgement, thus completing the 3-way handshake. In this way, TCP can establish a connection.
TCP is a reliable protocol, meaning that the data that is sent is reached by the receiving party, which is not an entity in UDP. Data packets that are lost are resent again, if the connection fails then the data is re-requested, thus making sure that data is received at the other end.
TCP enables data to be received in an ordered way, meaning if 5 data packets are sent, then data packet 1 should be received before data packet 2. This doesn't happen in UDP which is a connection less and works on the principle of shoot the data. The working principle of UDP is to send the data without taking care whether it reaches its destination or not. The TCP protocol is considered to be a complete protocol and therefore is used many times over in systems than the unreliable UDP.
UDP is known as user datagram protocol. It is a connection less protocol. TCP is known as transmission control protocol and it is a connection oriented protocol. Both protocols are used for the communication between two ends.
TCP has following advantages over UDP.
(1) TCP gives guarantee that a packet will reach on the destination without any duplication and the order of data will be same. On the other hand UDP does not give guarantee that data will reach on destination. it does not gives guarantee that data will be in the same order and it also does not give guarantee that data will reached on destination without any duplication.
(2) TCP is a reliable protocol but UDP is unreliable protocol.
(3) Data transmission is more dependable on TCP than UDP.
(4) As TCP is connection oriented protocol, it means that connection must be open between two ends before sending data. So both ends know all the things between a session as when the connection is closed and when it is opened. But in UDP when you send the data from one end then we cannot know whether data is reaching on the other end or not. As we just hope that it will reach on destination.
Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) both are transmission providers in the Internet Protocol (IP) environment. The Internet Protocol is typically made up of set of two protocols, namely the Transmission Control Protocol (TCP) and the Internet Protocol (IP) TCP works at the 4th layer, i.e. Transport layer of the OSI reference model. TCP provides are stream data transfer, reliability, efficient flow control, full-duplex operation, and multiplexing. The User Datagram Protocol (UDP) is a connectionless protocol which also works at the 4th layer and belongs to the Internet protocol family. UDP is basically an interface between IP and upper-layer processes. UDP protocol ports distinguish multiple applications running on a single device from one another. UDP is almost a null protocol; the only services it provides over IP are checksumming of data and multiplexing by port number. TCP guarantees actual data transmission without any loss whereas UDP does not guarantees this; TCP provides Flow and Congesion control whereas UDP does not; TCP is connection oriented whereas UDP is not; TCP detects data duplication but UDP does not. TCP is capable of multiplexing where as UDP is not. TCP protocol supports full-duplex (two ways) transmission
Tcp gives a confirmation of transmission while udp just goes on sending messages irrespective of knowing whether the messages are reaching destination or no.
TCP provides Flow and Congestion control whereas UDP does not;
TCP is connection oriented whereas UDP is not;
TCP detects data duplication but UDP does not.
TCP is capable of multiplexing where as UDP is not
Tcp provides error checking while udp does not so its faster in data data(udp is traffic free)
These are protocols for using data transfer.this is most important for communicate in network