Transort layer
Transport Layer Services
•Starts and stops the connection of the transmission.
•At the transmitter, it is responsible for chopping the stream of data into transportable
datagrams, numbering them and then sending them one by one.
•At the receiver, it is responsible for waiting until all datagrams have arrived, checking for
errors and then processing as a stream.
•Provides connection mechanism between two or more running application programs.
•Transmission control protocol (TCP) with flow control
•User datagram protocol (UDP) with no flow control
Transmission Control Protocol (TCP)
•Connection-oriented protocol and reliable transport protocol.
•Create a virtual connection between two application programs to send data.
•Virtual connection – connected as in the transport layer
TCP (Transmission Control Protocol) Service model:
TCP (Transmission Control Protocol) Service model .
It lies between the Application and Network Layers which are used in providing reliable
delivery services.
Transmission Control Protocol (TCP) ensures reliable and efficient data transmission over
the internet.
TCP plays a crucial role in managing the flow of data between computers, guaranteeing that
information is delivered accurately and in the correct sequence through:
• Message segmentation at the sender side.
• Sequence numbering of the segments at the sender side.
• Recovering missing segments at receiver side.
• Reassembly of segments to form original message at receiver side.
Features of TCP/IP
•Some of the most prominent features of Transmission control protocol are mentioned
below.
•Segment Numbering System: TCP keeps track of the segments being transmitted or
received by assigning numbers to each and every single one of them. A specific Byte
Number is assigned to data bytes that are to be transferred while segments are assigned
sequence numbers. Acknowledgment Numbers are assigned to received segments.
•Connection Oriented: It means sender and receiver are connected to each other till the
completion of the process. The order of the data is maintained i.e. order remains same
before and after transmission.
•Full Duplex: In TCP data can be transmitted from receiver to the sender or vice – versa at
the same time. It increases efficiency of data flow between sender and receiver.
•Flow Control: Flow control limits the rate at which a sender transfers data. This is done to
ensure reliable delivery. The receiver continually hints to the sender on how much data can
be received (using a sliding window).
•Error Control: TCP implements an error control mechanism for reliable data transfer. Error
control is byte- oriented. Segments are checked for error detection. Error Control includes –
Corrupted Segment & Lost Segment Management, Out-of-order segments, Duplicate
segments, etc.
•Congestion Control: TCP takes into account the level of congestion in the network.
Congestion level is determined by the amount of data sent by a sender.
The TCP Segment Header
Header 2
The pseudoheader included in the TCP checksum.
TCP Connection Establishment
Three protocol scenarios for establishing a connection using a three-way handshake. CR
denotes CONNECTION REQUEST.
(a) Normal operation,
(b) Old CONNECTION REQUEST appearing out of nowhere.
(c) Duplicate CONNECTION REQUEST and duplicate ACK.
TCP Connection Release
Abrupt disconnection with loss of data.
The 2 – army problem in TCP connection/release
The two-army problem.
The 2 – army problem in TCP connection release
The two-army problem.
•In the Two army Problem, the scenario involves two generals, each leading blue army,
who are situated in separate locations and must coordinate an attack on a white enemy
fortress. The only way to defeat the enemy is if first general soldiers and other general
soldiers make a coordinated attack from opposite sides of the valley, and they must agree
on the attack’s timing and strategy. However, there are several challenges:
•Lack of Direct Communication: The generals are located at a distance from each other,
making direct communication difficult. They can only exchange messages through
messengers or some form of communication channel, which is not entirely reliable.
•Uncertainty: There needs to be more certainty in message delivery times. Messages
between the generals may be delayed or lost in transit, leading to a lack of synchronization
in their attack plans.
•Double Confirmation: The generals need a way to confirm that they have both agreed on
the plan before initiating the attack. They must ensure that neither of them prematurely
attacks the fortress while the other is not ready.
The 2 – army problem in TCP connection/release
How is this Related to Computer Science and TCP?
Consider a scenario where two computer systems engage in communication.
The central challenge in this context remains the presence of an unreliable communication
channel and the potential for inconsistent states between the two machines.
The TCP protocol is a frequently used example when discussing the Two Generals’ Problem.
As you may be aware, TCP employs a procedure known as the 4-way handshake (or 3-way
handshake) to gracefully terminate a connection. In this process, one system wishing to end
the connection sends a FIN (Finish) message, to which the opposing system responds with
an ACK (Acknowledgment) and initiates its own FIN transmission.
Finally, the initiating system acknowledges the termination by sending another ACK. This
mechanism appears sound, but it reintroduces the familiar issue of shared knowledge
between the two systems.