Transport layer is the heart of the whole protocol hierarchy. Applications will exchange data with TCP/IP transport layer to communicate with Internet. The task of the transport layer is to provide cost effective and reliable data transport from source computer to destination computer, independent of physical network used. Transport layer consists of Transport Control Protocol (TCP) and User Datagram Protocol (UDP). TCP and UDP deliver data between applications.
TCP is a connection oriented protocol that uses a reliable byte-stream to send and receive data. UDP is an unreliable connectionless protocol which uses datagrams to send and receive data.
User Datagram Protocol (UDP)
UDP is an unreliable connectionless protocol like IP that use datagrams for data delivery. IP delivers data to a host computer but UDP deliver data to multiple destinations on a single host. A UDP datagram consists of a header and data. The header is shown in below table. UDP header is a 8 byte wide. The port fields are 16 bit integer values represent protocol port. The sourse port field identifies the port number that sent the data and destination port field identifies the port that will receive the data. Length field specifies the length of the UDP datagram including it’s header. The checksum field is used for error checking of the header and data. UDP module accept all incoming datagrams and then sorts and distributes them based on destination port numbers.
|0||UDP Source Port||UDP Destination Port|
|32||UDP Message Length||UDP Checksum|
Transport Control Protocol (TCP)
TCP is most commonly used protocol in the TCP/IP protocol suite in data delivery system. TCP transports data between network and application layers. TCP provides reliable byte-stream connection oriented data delivery service. TCP also tries to optimize the network bandwidth. i.e. It tries to increase the throughout of the data accross the Internet. TCP dynamically control the flow of data to optimize the network throughput. TCP will tell sending end to reduce transmission speed when data buffer overflow occurs at receiving end.
TCP uses sliding window concept to increase the data throughput for transmitting messages over network. TCP sends data over network in packets and waits for acknowledgement from the receiving end before transmitting another packet. In sliding window concept TCP sends multiple data packets at a time without waiting for acknowledgment from the receiving end. Number of packets depends upon the sliding window width. Width of the sliding window varies depends on the acknowledgement from the receiving end. Information about the receiving device’s buffer size includes in the acknowledgement, which tells the sending end to increase or decrease the number of packets in the next transmission. Window width increases or decreases according to acknowledgement so that this concept is called sliding window. TCP can pump lot of information into the data stream by working with multiple messages at a time. TCP improves the efficiency and data throughput of the transmission by sending multiple packets at a time according to the information in acknowledgement from receiving end. TCP also optimizes network bandwidth by increasing sliding window width when data traffic on the Internet is light and traffic congestion is minimal and reduce the width of the sliding window when Internet traffic congestion is high.