Learning coding means GreatToCode Be more than a Coder ! Greattocode , Join GreatToCode Community,1000+ Students Trusted On Us .If You want to learn coding, Then GreatToCode Help You.No matter what It Takes !


CODE YOUR WAY TO A MORE FULFILLING And HIGHER PAYING CAREER IN TECH, START CODING FOR FREE Camp With GreatToCode - Join the Thousands learning to code with GreatToCode
Interactive online coding classes for at-home learning with GreatToCode . Try ₹Free Per Month Coding Classes With The Top Teachers . Transport Layer

Transport Layer

Become More Then A coder | Learn & Start Coding Now.


4.1 Transport layer services:

The transport layer provides process-to-process communication services to the upper layer protocols. The following are some of the key services offered by the transport layer:

- Addressing: The transport layer adds a port number to the source and destination IP addresses to identify the sending and receiving processes. This combination of IP address and port number is known as a socket.
- Encapsulation and decapsulation: The transport layer encapsulates the application layer data into a transport layer segment or datagram, and then encapsulates it into an IP packet. At the receiving end, the transport layer decapsulates the data from the IP packet and delivers it to the application layer.
- Multiplexing and demultiplexing: The transport layer multiplexes multiple application layer sessions onto a single network connection and demultiplexes the received data back to the correct application layer session.
- Flow control: The transport layer ensures that the sender does not overwhelm the receiver with data, by implementing flow control mechanisms. These mechanisms regulate the rate at which data is sent by the sender, based on the receiver's ability to process the data.
- Pushing or pulling: The transport layer can either push data to the receiver or wait for the receiver to pull the data.
- Buffers: The transport layer maintains buffers to temporarily store data that cannot be immediately delivered to the receiving application layer.
- Sequence numbers: The transport layer assigns sequence numbers to the data segments to ensure reliable delivery and to allow the receiver to reorder the segments.
- Acknowledgements: The transport layer uses acknowledgements to indicate successful receipt of data segments and to request retransmission of missing or corrupted segments.
- Sliding window: The transport layer uses a sliding window protocol to regulate the flow of data and to provide reliable delivery.
- Congestion control: The transport layer implements congestion control mechanisms to avoid network congestion and to ensure fair sharing of network resources.

4.2 Connectionless and Connection-oriented services:

The transport layer can provide either connectionless or connection-oriented services.

- Connectionless service: In a connectionless service, the transport layer does not establish a dedicated end-to-end connection before sending data. Each segment is treated as an independent unit and is forwarded independently by the network layer. User Datagram Protocol (UDP) is an example of a connectionless transport protocol.
- Connection-oriented service: In a connection-oriented service, the transport layer establishes a dedicated end-to-end connection before sending data. The connection is maintained throughout the session and torn down when the session is complete. Transmission Control Protocol (TCP) is an example of a connection-oriented transport protocol.

Port numbers:

Port numbers are used by the transport layer to identify the processes or services running on the host. The port numbers are 16-bit numbers, and the well-known port numbers are reserved for standard services. Port numbers from 0 to 1023 are reserved for well-known services, and port numbers from 1024 to 65535 are available for dynamic or private use.

4.3 User Datagram Protocol (UDP):

UDP is a connectionless transport protocol that provides minimal services to the upper layers. UDP provides multiplexing and demultiplexing services and adds a header with source and destination port numbers to the user data. UDP does not guarantee reliable delivery or flow control, and does not establish a connection before sending data.

UDP services:

UDP provides the following services:

- Multiplexing and demultiplexing: UDP multiplexes multiple application layer sessions onto a single network connection and demultiplexes the received data back to the correct application layer session.
- Unreliable data transfer: UDP does not guarantee reliable delivery or flow control.
- Low overhead: UDP adds a minimal header to the user data, resulting in low overhead and high efficiency.


Transmission Control Protocol (TCP) is a reliable, connection-oriented protocol that provides error detection and correction, flow control, and congestion control services to ensure the reliable delivery of data across the network. TCP operates at the transport layer of the OSI model and is used by applications such as email, file transfer, and web browsing.

TCP Services:
1. Reliable data delivery
2. Flow control
3. Congestion control
4. Error detection and correction
5. Multiplexing

TCP Features:
1. Connection-oriented
2. Reliable
3. Byte-oriented
4. Full duplex communication
5. Stream-oriented

TCP Segment Format:
TCP segment consists of a header and a data section. The header contains 10 fields, some of which are optional. The fields are:
1. Source port
2. Destination port
3. Sequence number
4. Acknowledgment number
5. Data offset
6. Reserved
7. Control bits
8. Window size
9. Checksum
10. Urgent pointer

Three-way handshake for connection establishment:
1. The client sends a SYN packet to the server.
2. The server responds with a SYN-ACK packet.
3. The client sends an ACK packet to the server.

Three-way handshake for connection termination:
1. The client sends a FIN packet to the server.
2. The server responds with an ACK packet.
3. The server sends a FIN packet to the client.
4. The client responds with an ACK packet.

State transition diagram:
TCP uses a state transition diagram to keep track of the state of each connection. The states are:
1. CLOSED
2. LISTEN
3. SYN SENT
4. SYN RECEIVED
5. ESTABLISHED
6. FIN WAIT 1
7. FIN WAIT 2
8. CLOSING
9. TIME WAIT
10. CLOSE WAIT
11. LAST ACK

Windows in TCP:
TCP uses a sliding window protocol to control the flow of data between the sender and receiver. The sender and receiver both maintain a window size, which determines the amount of data that can be sent before receiving an acknowledgment. The window size is included in the TCP header and can be dynamically adjusted based on network conditions.


Post a Comment

0 Comments

•Give The opportunity to your child with GreatToCode Kid's • Online Coding Classes for Your Kid • Introduce Your kid To the world's of coding
•Fuel You Career with our 100+ Hiring Partners, Advance Your Career in Tech with GreatToCode. •Join The Largest Tech and coding Community and Fast Forward Your career with GreatToCode. •10000+ Learner's+ 90 % placement Guarantee. • Learning Coding is Better with the GreatToCode community .
•Greattocode Kid's •GreatToCode Career •GreatToCode Interview •GreatToCode Professional •GreatToCode for schools •GreatToCode For colleges •GreatToCods For Businesses.
Are you ready to join the millions of people learning to code? GreatToCode Pass is your one-stop-shop to get access to 1000+ courses, top-notch support, and successful job placement. What are you waiting for? Sign up now and get your future in motion with GreatToCode Pass.