What is the Difference Between TCP and UDP?
TCP and UDP are both protocols used to send data over the internet but they do this in a slightly different way. Transmission Control Protocol (TCP) is the most commonly use protocol on the internet. When information is sent as data packets through TCP, your browser will stitch these packets back together to present you, for example, with a web page that you requested. TCP will make sure that the packets are all received and in the right order before it servers you the page so it guarantees delivery. User Datagram Protocol (UDP) on the other hand, will not perform any of the error checking that TCP does making it significantly faster. This is why UDP is better for video streaming or gaming, for example, while TCP is the go-to protocol for your normal browsing.
UDP | TCP |
Reliability: UDP is less reliable as it is a connectionless protocol. When you send a message using UDP internet protocol, it is not guaranteed if it will reach the destination or get lost in between the transmission. UDP may also corrupt a message during transfer. | Reliability: TCP is more reliable as it is connection-oriented internet protocol. If you deliver a message using TCP protocol, it will reach the destination unless the connection fails. If connection drops the server will request the lost part and cause no corruption during transferring the message. |
Order: If you send two messages, you don’t know what order they will arrive in. | Order: If you send two messages one after another. It is guaranteed that first one will arrive first. With TCP, you don’t have to worry about the order of the messages. They will arrive in the same order as you send them. |
Weight: UDP is a lightweight internet protocol. No order of messages and no connection. It just sends and forgets. It is a lot faster than TCP, and the OS has very little to do to translate the message from the packets. | Weight: TCP is heavy weight internet protocol. It is connection-oriented and manages order of messages. It requires more time to do the work and the OS needs little more time to read the message from the packets. |
Datagrams: Each data packet is sent individually to guarantee its completeness on arrival. Also, there is only one packet per one read call. | Streaming: In TCP protocols, packet reads one after another. Data is read as ‘Stream’, so there may be multiple packets for one read call. |
Sample: Domain Name System (DNS UDP port 53), Streaming Applications such as IPTV, VoIP, Trivial File Transfer Protocol (TFTP) and MMORPG (Multiple role playing games) | Sample: World Wide Web (Apache TCP port 80), File Transfer Protocol (FTP port 21), e-mail (SMTP TCP port 25 Postfix MTA) and Secure Shell (OpenSSH port 22) etc. |
Comments
Post a Comment