Pages

Friday, 9 November 2012

Difference between TCP and UDP Protocols (TCP vs UDP)

Difference between TCP and UDP Protocols (TCP vs UDP)

This article providers basic difference between TCP and UDP. We will compare various parameters like reliability, complexity, safety, speed and sequencing of TCP and UDP.

1. TCP is Transmission Control Protocol while UDP is User Datagram Protocol.

2. Connection Oriented vs Connection Less Protocols

Transmission Control Protocol (TCP) is a connection oriented protocol, which means the devices should open a connection before transmitting data and should close the connection after transmitting the data.

On the other hand, UDP is connectionless protocol with no overhead for opening, maintaining, and closing a connection.

3. Reliability and Safety of message devlivery in TCP and UDP

TCP: When a file or message sent, it will get delivered unless connections fails. If connection lost, the server will request the lost part. There is no corruption while transferring a message.  Delivery of data is guaranteed if you are using Transmission Control Protocol (TCP).

TCP uses, 3 way handshake, congestion control, flow control and other mechanism to make sure the reliable transmission. Transmission Control Protocol (TCP) protocol provides extensive error checking mechanisms such as flow control and acknowledgment of data.

UDP: When you a send a data or message, you don't know if it'll get there, it could get lost on the way. There may be corruption while transferring a message. UDP is mostly used in cases where the packet delay is more serious than packet loss. The delivery of data cannot be guaranteed in User Datagram protocol (UDP) .

4. Order Maintenance and Sequencing of message devlivery in TCP and UDP

TCP: If you send two messages along a connection, one after the other, you know the first message will get there first. You don't have to worry about data arriving in the wrong order. Sequencing of data is a feature of Transmission Control Protocol (TCP).

UDP: If you send two messages out, you don't know what order they'll arrive. There is no sequencing of data in User Datagram protocol (UDP) .

5. Speed comarison of TCP and UDP

Transmission Control Protocol (TCP) is comparatively slower to UDP  because of extensive error checking mechanisms such as flow control and acknowledgment of data.

On the other hand, User Datagram protocol (UDP) has only the basic error checking mechanism using checksums. User Datagram Protocol (UDP) is efficient for broadcast/multicast transmission. UDP is faster for sending small amounts of data since no connection setup is required, the data can be sent in less time then it takes for TCP to establish a connection.

6. Simplicity and complexity: UDP is very much simpler and less complex as compared to TCP.

7. Multiplexing and Demultiplexing

TCP: Multiplexing and Demultiplexing is possible in Transmission Control Protocol (TCP) using TCP port numbers.

UDP: Multiplexing and Demultiplexing is possible in User Datagram Protcol (UDP) using UDP port numbers.

8. Retransmission of lost packets

TCP: Retransmission of lost packets is possible in Transmission Control Protocol (TCP).

UDP: There is no retransmission of lost packets in User Datagram Protcol (UDP).

9. Length of Packets

TCP provides a stream of unlimited length, UDP sends small packets.

10. Examples of TCP and  UDP

TCP Examples:

A) World Wide Web (TCP Port 80)
B) Email (SMTP TCP Port 25)
C) File Transfer Protocol (FTP Port 21)
D) Secure Shell (OpenSSH Port 22)
E) Telnet

UDP Examples:

A) Domain Name System (DNS UDP Port 53)
B) Streaming media applications such as IPTV or movies
C) Voice over IP (VoIP)
D) Trivial File Transfer Protocol (TFTP)
E) Online multiplayer games etc

Summary: User Datagram protocol (UDP) is faster, simpler and more efficient than TCP. However, User Datagram protocol (UDP) it is less robust then TCP

No comments:

Post a Comment