TCP is often described as a byte stream, connection-oriented, reliable delivery transport layer protocol .TCP provides the service of exchanging data directly between two hosts on the same network.TCP provides a point-to-point channel for applications that require reliable communications. The Hypertext Transfer Protocol, File Transfer Protocol and Telnet are all examples of applications that require a reliable communication channel.
UDP is almost a null protocol the only services it provides over IP are checksumming of data and multiplexing by port number. The User Datagram Protocol offers only a minimal transport service non-guaranteed datagram delivery and gives applications direct access to the datagram service of the IP layer. UDP is used by applications that do not require the level of service of TCP or that wish to use communications services (e.g., multicast or broadcast delivery) not available from TCP.
TCP/UDP advantages and disadvantages
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 re-sent 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 two data packets are sent, then one data packet should be received first before another data packet because another packet was sent after. This does not 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.