Translate

Thursday 11 February 2016

TCP VS UDP

Layer 4 of the OSI model called Transport layer, is used for transmitting data from source to destination.
On basis of their transmission of data and connections we decide it to be TCP or UDP.

Both TCP and UDP Protocols are used for sending bits of data known as packets.They are build on Top of Internet  Protocol.

TCP (Transmission Control Protocol) as the name states it is connection oriented protocol. In TCP, there is an open connection established between Sender and Receiver. After TCP session established bi-directional data flows.

Whereas in UDP (User Datagram Protocol) it is connectionless Internet Protocol. It does not require open connection to be established between Sender and Receiver.

TCP and UDP have common header fields (source and destination port) and checksum.


Differences in Data Transfer Features
TCP ensures a reliable and ordered delivery of a stream of bytes from user to server or vice versa. UDP is not dedicated to end to end connections and communication does not check readiness of receiver.

Reliability
TCP is more reliable since it manages message acknowledgment and retransmissions in case of lost parts. Thus there is absolutely no missing data. UDP does not ensure that communication has reached receiver since concepts of acknowledgment, time out and retransmission are not present.

Ordering
TCP transmissions are sent in a sequence and they are received in the same sequence. In the event of data segments arriving in wrong order, TCP reorders and delivers application. In the case of UDP, sent message sequence may not be maintained when it reaches receiving application. There is absolutely no way of predicting the order in which message will be received.

Connection
TCP is a heavy weight connection requiring three packets for a socket connection and handles congestion control and reliability. UDP is a lightweight transport layer designed atop an IP. There are no tracking connections or ordering of messages.

Method of transfer
TCP reads data as a byte stream and message is transmitted to segment boundaries. UDP messages are packets which are sent individually and on arrival are checked for their integrity. Packets have defined boundaries while data stream has none.

No comments:

Post a Comment