Understanding 4th Layer of OSI Model - Transport Layer
Transport Layer
Introduction to Transport Layer
The Transmission Control Protocol (TCP) standard is defined in the Request For Comment (RFC) standards document number 793 [10] by the Internet Engineering Task Force (IETF). The original specification written in 1981 was based on earlier research and experimentation in the original ARPANET.
- The fourth and “middle” layer of the OSI Reference Model protocol stack is the transport layer, that does not actually transport data, despite its name but ensures that messages are delivered error-free, in sequence, and with no losses or duplications.
Transport layer communication falls under two categories:
- Connection-oriented – requires that a connection with specific agreed-upon parameters be established before data is sent.
- Connectionless– requires no connection before data is sent
Transport Layer Functions
Process-Level Addressing | Transport-layer process-level addressing is the TCP and UDP port mechanism used in TCP/IP, which allows applications to be individually referenced on any TCP/IP device. |
Multiplexing and Demultiplexing | Transport layer protocols on a sending device multiplex the data received from many application programs for transport, combining them into a single stream of data to be sent. |
Segmentation, Packaging and Reassembly | The transport layer segment the large amounts of data it sends over the network into smaller pieces on the source machine and then reassemble them on the destination machine. |
Connection Establishment, Management, and Termination | Transport layer connection-oriented protocols are responsible for the series of communications required to establish a connection, maintain it as data is sent over it, and then terminate the connection when it is no longer required. |
Acknowledgments and Retransmissions | provide guarantee reliable delivery of data using most commonly the combination of acknowledgments and retransmission timers. |
Flow Control | This features allow one device in a communication to specify to another that it must "throttle back" the rate at which it is sending data, to avoid bogging down the receiver with data. These allow mismatches in speed between sender and receiver to be detected and dealt with. |
Major protocols of Transport Layer
As I mentioned above Transport layer is a layer which actually does not sent data but only prepares for transport. So for the same purposes, this layer uses two major protocols TCP & UDP.
TCP (Transmission control protocol)
TCP is often described as a byte stream, connection-oriented, reliable delivery transport layer protocol.
UDP (User Datagram Protocols) .
UDP is basically an application interface to IP. It adds no reliability, flow control, or error recovery to IP. It simply serves as a multiplexer/DE-multiplexer for sending and receiving datagrams, using ports to direct the datagrams
Ports and sockets
These are needed to determine which local process at a given host actually communicates with which process, at which remote host, using which protocol. Consider the following example:
- An application process is assigned a process identifier number (process ID), which is likely to be different each time that process is started.
- Process IDs differ between operating system platforms. Hence, they are not uniform.
- A server process can have multiple connections to multiple clients at a time, hence simple connection identifiers would not be unique.
The concept of ports and sockets provides a way to uniformly and uniquely identify connections and the programs and hosts that are engaged in them, irrespective of specific process IDs.
Ports
A port is a 16-bit number, used by the host-to-host protocol to identify to which higher level protocol or application program (process) it must deliver incoming messages. There are two types of port:
- Well-known: Well-known ports belong to standard servers, for example, Telnet uses port 23. Well-known port numbers range between 1 and 1023.
The well-known ports are controlled and assigned by the Internet Assigned Number Authority (IANA).
- Ephemeral: Ephemeral port numbers have values greater than 1023, normally in the range 1024 to 65535. A client can use any number allocated to it, as long as the combination of is unique.
Ephemeral ports are not controlled by IANA and can be used by ordinary user-developed programs on most systems.
Sockets
Sockets are the door between Transport and Application Layer. The socket interface is one of several application programming interfaces (APIs) to the communication protocols. These are simply a combination of transport layer protocol, ip address& port number.
- A socket is a special type of file handle, which is used by a process to request network services from the operating system.
- A socket address is a triple:
For example, in the TCP/IP suite:
- An association is the 5-tuple that completely specifies the two processes that comprise a connection:
In the TCP/IP suite, the following could be a valid association:
Note: - By typing netstat at a Windows Command prompt you can see the connections your computer has.
Multiplexing and De-Multiplexing by Transport Layer
Multiplexing and De-multiplexing are the two very important functions that are performed by Transport Layer.
Transport layer at the sender side receives data from different Applications, encapsulates every packet with a Transport Layer header and pass it on to the underlying Network Layer. This job of the transport layer is known as Multiplexing.
At the receiver's side, the transport gathers the data, examines its socket and passes the data to the correct Application. This is known as De-Multiplexing
Segmentation, Packaging and Reassembly - Transport Layer
SEGMENTATION
Segmentation is the process of breaking up information into smaller pieces also refers to what it calls 'data streams'.
Chopping the data into segments has several advantages. Once segmented, the segments are referred to individually as protocol data units. These PDU's are encapsulated into packets. Packets can be sent along more than one path to the destination. This increases both the reliability, and the speed at which data can travel across a network.
SEQUENCING
TCP packages the data as segments and assigns a sequence number to each segment. It allows the receiving host to reassemble the data from multiple segments in the correct order, upon arrival.
REASSEMBLY
Reassembly is the reverse of segmentation. Protocol Data Units are put back together in the correct order to reassemble a stream of data in its original form.
TCP Connection Establishment and Termination
When two hosts communicate using TCP, a connection is established before data can be exchanged. This is handled by the process called a Three-way handshaking method.
The Three-way handshake begins with the initiator sending a TCP segment with the SYN control bit flag set.
TCP identifies two types of OPEN calls:
Active OpenIn an Active Open call a device (client process) using TCP takes the active role and initiates the connection by sending a TCP SYN message to start the connection.
Passive Open A passive OPEN can specify that the device (server process) is waiting for an active OPEN from a specific client. It does not generate any TCP message segment. The server processes listening for the clients are in Passive Open mode.
Step 1. Client PC sends a TCP segment with SYN = 1, ACK = 0, ISN (Initial Sequence Number) = 1000.
(Note: -An32bit Initial Sequence Number (ISN) is a random Sequence Number, allocated for the first packet in a new TCP connection.)
The Active Open device (Client PC) sends a segment with the SYN flag set to 1, ACK flag set to 0 and an Initial Sequence Number 1000 (For Example), which marks the beginning of the sequence numbers for data that Client PC will transmit. SYN flag announces an attempt to open a connection.
Step 2.Server receives Client PC’s TCP segment and returns a TCP segment with SYN = 1, ACK = 1, ISN = 2000 (Server Initial Sequence Number), Acknowledgment Number = 2001 (2000 + 1, the next sequence number Server expecting from Client PC).
Step 3. Client PC sends a TCP segment to Server that acknowledges receipt of ServerISN, With flags set as SYN = 0, ACK = 1, Sequence number = 1002, Acknowledgment number = 2001 (2000 + 1, the next sequence number Client PC expecting from Server)
After the Three-way handshake, the connection is open and the participant computers start sending data using the agreed sequence and acknowledge numbers.
Connection Termination
Connection Termination is a Four step process or also called as Four-way Hand-shaking.
The four steps are as follows,
The PC1 TCP sends the FIN segment first, ISN=1000(for example).
The PC2 TCP sends the ACK segment to confirm the receipt of the FIN from the client. It increments the sequence number of FIN by 1 and no other user data will add with the ACK segment, ACK=1001.
PC2 does not have any data for transmission, and then it sends the FIN segment to PC1, ISN=1470.
Then PC1 sends the ACK segment again to the server side, ACK=1471. The connection termination fulfilled.
Acknowledgments and Retransmissions
Retransmissions. In order to guarantee delivery of data, TCP must implement retransmission schemes for data that may be lost or damaged. To ensure reliable delivery of data and retransmission of segments, TCP uses different types of acknowledgments.
Acknowledgements. This is the process used by TCP communication through which sender ensures that data is transmitted successfully at the receiver end or lost. Some types of acknowledgments used by TCP are as follows:-
Positive Ack | The receiver explicitly notifies the sender which packets, messages or segments were received correctly also implicitly informs the sender which packets were not received and provides detail on packets which need to be retransmitted. |
Negative Ack (NACK) | the receiver explicitly notifies the sender which packets, messages, or segments were received incorrectly and thus may need to be retransmitted. |
Selective Ack (SACK) | the receiver explicitly lists which packets, messages, or segments in a stream are acknowledged (either negatively or positively) useful in Satellite Internet access. |
Cumulative Ack | The receiver acknowledges that it correctly received a packet, message, or segment in a stream which implicitly informs the sender that the previous packets were received correctly. TCP uses cumulative acknowledgment with its TCP sliding window. |
Flow Control
Flow control is a mechanism through which transport layer can handle problems like the rate of data transmission, buffer full (a drop of segments) & congestion control etc. for the same purposes it utilizes the method called window sliding protocol.
This window mechanism ensures:
- Reliable transmission.
- Better use of the network bandwidth (better throughput).
- Flow-control, since the receiver may delay replying to a packet with an acknowledgment,
Knowing its free buffers are available and the window-size of the communication.
Transport Layer is 4th Layer and one of the most important and confusing layer of OSI Model and of'course if you are preparing for CCNA Certification exam, you can not pass it if basic concepts of OSI Model are not clear to you. If you are looking for Best Institute for CCNA course in India, then your search should end here. Go to Network Bulls' website and see how it is different from other training institutes worldwide.
- RECOMMENDED POSTS
Well Great Explanation....very nice sir. Thanking You.