Transport Layer
Transport Layer
UNIT-IV
TRANSPORT LAYER
PREPARED
BY
P.SANTHOSH KUMAR
K.VINOD KUMAR
Introduction
TCP is used for connection oriented purpose, UDP is used for Connection less purpose.
Transmission control protocol(TCP)
1. Source Port-
Source Port is a 16 bit field.
It identifies the port of the sending application.
2. Destination Port-
Destination Port is a 16 bit field.
It identifies the port of the receiving application.
3.Sequence Number-
Sequence number is a 32 bit field.
TCP assigns a unique sequence number to each byte of data contained in the TCP segment.
This field contains the sequence number of the first data byte.
Description-2/5
4. Acknowledgement Number-
Acknowledgment number is a 32 bit field.
It contains sequence number of the data byte that receiver expects to receive next from the
sender.
It is always sequence number of the last received data byte incremented by 1.
5. Header Length-
Header length is a 4 bit field.
It contains the length of TCP header.
It helps in knowing from where the actual data begins.
Description-3/5
6. Reserved Bits-
The 6 bits are reserved.
These bits are not used.
URG bit is used to treat certain data on an urgent basis.
ACK bit indicates whether acknowledgement number field is valid or not.
PSH bit is used to push the entire buffer immediately to the receiving application.
RST bit is used to reset the TCP connection.
SYN bit is used to synchronize the sequence numbers.
FIN bit is used to terminate the TCP connection.
Description-4/5
Window Size-
Window size is a 16 bit field.
It contains the size of the receiving window of the sender.
It advertises how much data (in bytes) the sender can receive without acknowledgement.
Checksum-
Checksum is a 16 bit field used for error control.
It verifies the integrity of data in the TCP payload.
Sender adds CRC checksum to the checksum field before sending the data.
Receiver rejects the data that fails the CRC check.
Description5/5
Urgent Pointer-
Urgent pointer is a 16 bit field.
It indicates how much data in the current segment counting from the first data byte is
urgent.
Urgent pointer added to the sequence number indicates the end of urgent data byte.
This field is considered valid and evaluated only if the URG bit is set to 1.
Options-
Options field is used for several purposes.
The size of options field vary from 0 bytes to 40 bytes.
TCP Connection
For connecting two devices(i.e client and server) we are using three phases
A TCP connection is terminated using FIN segment where FIN bit is set to 1.
Consider-
There is a well established TCP connection between the client and server.
Client wants to terminate the connection.
The following steps are followed in terminating the connection-
Step-01:
For terminating the connection,
Client sends a FIN segment to the server with FIN bit set to 1.
Client enters the FIN_WAIT_1 state.
Client waits for an acknowledgement from the server.
TCP Connection Termination-
Step-1 Step-2
TCP Connection Termination-
Step-3 Step-4