28.3 TCP and UDP Protocols

   

The Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP) are used in the transport layer (fourth layer) of the TCP/IP protocol stack. Depending on particular requirements, different applications in the application layer of the TCP/IP protocol stack use one or both of these protocols for data communication. A short explanation of these two protocols is presented here.

TCP Protocol

TCP is designed for reliable data transfer. When this protocol is used, the sending side fragments data into smaller data packets. These data packets are then transferred to the destination host. Each data packet contains source and destination IP addresses, data, a sequence number, and checksum fields, in addition to other information. When these data packets reach their destination, the receiving host checks for errors and packet sequences. It then acknowledges the sending host that the packets were received. If a data packet contains an error or is lost along the way, the receiving host requests the sending host to retransmit the data packets. After successfully receiving all data packets, the receiving host reassembles the data packets according to their sequence numbers and regenerates the actual data.

TCP is a reliable data transmission method because the transport layer is responsible for recovering from lost or faulty data packets. TCP is also called a connection-oriented protocol because both sending and receiving hosts establish a connection before actual data transfer takes place. A TCP connection can be thought of as a phone call where you have to establish a connection before starting the conversation.

UDP Protocol

UDP is a connection-less protocol because no connection is established between sending and receiving hosts before starting the communication process. It is not a reliable protocol in that the receiving host does not send any acknowledgement to the sending host after receiving data packets. If a packet is lost along the way, the sending host never knows about it. A UDP data transfer can be thought of as a letter sent by mail. Before sending a letter, you don't establish a link with the recipient. And you don't get any acknowledgment from the post office whether the letter is delivered.

In the UDP protocol, the application layer has responsibility for the reliability of the data. Due to less communication overhead, UDP is used in applications where speed is more important and loss of some data can be tolerated. Examples of such communication are voice and video communications over IP networks. Comparison of TCP and UDP protocols is presented in Table 28-3.

Table 28-3. Comparison of TCP and UDP Protocols
TCP Protocol UDP Protocol
It is a reliable protocol. Any errors or lost data is recovered with the acknowledgement mechanism. UDP is not a reliable protocol. If data are lost, UDP remains ignorant about it and continues to send the remaining data.
It is a connection-oriented protocol. A connection is established between source and destination hosts before starting data transmission. It is a connection-less protocol. The sending side starts transmitting data without establishing a connection with the receiving side.
TCP is a slow protocol because a considerable amount of the network traffic consists of acknowledgment packets. The transmitting side stops sending data when the TCP window (explained next ) limit is reached, and no acknowledgement is received from the receiving side. This happens even if there is no error in the transmission. UDP is a fast protocol because there are no acknowledgment packets. This reduces communication overhead.

TCP Window Size

During data transfer using TCP, a host can send multiple packets without receiving an acknowledgment from the receiving host. The amount of data that can be transmitted without being acknowledged is called the TCP window size. If an acknowledgment is not received during this time, the sending host stops sending data until it gets an acknowledgment from the receiving host.

TCP window size plays an important role in the efficiency of a network, especially wide area networks. Usually a larger window size is used on slower networks to improve efficiency of data transfer. Different window sizes can be used for sending and receiving data. The ndd command can be used to fine tune TCP window sizes.


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net