There are two well-known Transport Layer protocols used by the Internet Protocol suite, the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP). Note that TCP is the Transport layer portion of the famous TCP/IP protocol. IP is the network layer portion.
The purposes of the Transport Layer include:
Multiplexing – Once the underlying network layer gets a frame to the appropriate computer, it is the responsibility of the Transport layer to get the frame to the proper application on that computer. Data may be received on the same line for many different applications. The transport layer gives the data to the appropriate program and user. Each frame contains a 16 bit integer number, called a port number, that is used to identify the program that is to receive the frame. (Note port numbers are just integers, they do not refer to plugs on the back of the computer.) The port numbers 0 to 2047 are called “well known ports” and are reserved for specific applications. Port 80 is used by web servers, port 21 is used by ftp and port 23 is used by telnet. Both TCP and UDP provide multiplexing.
The following Transport Layer features are provided only by TCP.
Reliable communications – TCP guarantees that the data will arrive without errors. It corrects:
Corrupted frames – If a bit gets changed during transmission, TCP will detect the error and retransmit the corrupted frame.
Lost frames – If a frame does not arrive at the destination, TCP will detect this and have the sender resend the frame.
Out of order frames – The Internet Protocol routes each frame individually. If frames take different paths to the destination, they may arrive out of order. TCP will give them to the application layer in the correct order.
Flow control – TCP prevents the source from sending data faster than the receiving side can process it.
Stream orientated communications – TCP presents the data to the application layer as a continuous steam of bytes. It removes the frame boundaries so the application is unaware of the size and number of frames used to send the data.
Students frequently ask, “Why would you want to use a protocol such as UDP that allows, lost frames, corrupted frames, overflows and several other network sins?” The reason is that while UDP does almost nothing, it can do nothing very efficiently. TCP introduces significant overhead to provide the above list of services.