Chapter-7
The Transport Layer
Transmission Control Protocol (TCP)
◉ It is a process-to-process (program-to-program) protocol uses
port numbers
◉ It is a connection oriented(reliable) protocol; it creates a
virtual connection between two TCPs to send data
◉ TCP uses flow and error control mechanisms at the transport
level.
2
Features of a TCP protocol
❑ Reliable
◉ supports the acknowledgment mechanism, which checks the state and
sound arrival of the data.
◉ the receiver sends either positive or negative acknowledgment to the
sender so that the sender can get to know whether the data packet has
been received or needs to resend
❑ Order of the data is maintained
◉ It orders and numbers each segment so that the TCP layer on the
destination side can reassemble them based on their ordering.
3
Features of a TCP protocol
❑ Connection-oriented
◉ The data exchange occurs only after the connection establishment. When
the data transfer is completed, then the connection will get terminated.
❑ Full duplex
◉ It is a full-duplex means that the data can transfer in both directions at the
same time.
❑ Stream-oriented
◉ It allows the sender to send the data in the form of a stream of bytes and
also allows the receiver to accept the data in the form of a stream of bytes.
4
5
TCP Header format
◉ Source port: It defines the port of the application, which is sending the
data. So, this field contains the source port address, which is 16 bits.
◉ Destination port: It defines the port of the application on the receiving
side. So, this field contains the destination port address, which is 16 bits.
◉ Sequence number. This 32-bit field defines the number assigned to the
first byte of data contained in this segment
◉ TCP is a stream transport protocol. To ensure connectivity, each byte to be
transmitted is numbered
6
TCP Header format
◉ Acknowledgment number: This 32-bit field defines the byte
number that the receiver of the segment is expecting to
receive from the other party
◉ If the receiver of the segment has successfully received byte
number x from the other party, it defines x + 1 as the
acknowledgment number
◉ Acknowledgment and data can be piggybacked together.
7
TCP Header format
◉ Header length: This 4-bit field indicates the number of 4-byte
words in the TCP header.
◉ The length of the header can be between 20 and 60 bytes.
Therefore, the value of this field can be between 5 (5 x 4 =20)
and 15 (15 x 4 =60)
◉ Reserved: This is a 6-bit field reserved for future use.
◉ There are six control bits or flags:
8
TCP Header format
◉ URG: It represents an urgent pointer. If it is set, then the data is processed
urgently.
◉ ACK: If the ACK is set to 0, then it means that the data packet does not contain
an acknowledgment.
◉ PSH: If this field is set, then it requests the receiving device to push the data to
the receiving application without buffering it.
◉ RST: If it is set, then it requests to restart a connection.
◉ SYN: It is used to establish a connection between the hosts.
◉ FIN: It is used to release a connection, and no further data exchange will happen.
9
TCP Header format
◉ Window size: It is a 16-bit field. It contains the size of data that the receiver
can accept. This field is used for the flow control between the sender and
receiver and also determines the amount of buffer allocated by the receiver
for a segment
◉ The maximum size of the window is 65,535 bytes.
◉ Checksum
It is a 16-bit field. This field is optional in UDP, but in the case of TCP/IP,
this field is mandatory.
10
TCP Header format
◉ Urgent pointer: This l6-bit field, which is valid only if the urgent flag is
set, is used when the segment contains urgent data.
◉ It defines the number that must be added to the sequence number to obtain
the number of the last urgent byte in the data section of the segment
◉ Options
It provides additional options. The optional field is represented in 32-bits
11
Connection Establishment In TCP
12
Connection Establishment In TCP
◉ Three way handshaking
◉ Server TCP is ready to accept any connection, it cannot make the connection
itself.
1. The client sends the first segment, a SYN segment, in which only the SYN
flag is set. This segment is for synchronization of sequence numbers.
2. The server sends the second segment, a SYN +ACK segment, with 2 flag
bits set: SYN and ACK.
◉ This segment has a dual purpose. It is a SYN segment for communication in
the other direction and serves as the acknowledgment for the SYN segment.
13
Connection Establishment In TCP
14
Connection Establishment In TCP
3. The client sends the third segment. This is just an ACK segment.
◉ It acknowledges the receipt of the second segment with the ACK flag
and acknowledgment number field
◉ SYN Flooding Attack: It belongs to a type of security attack known as
a denial-of-service attack, in which an attacker monopolizes a system
with so many service requests that the system collapses and denies
service to every request
◉ Window size also will be exchanged during this time for flow control
15
Data Transfer
16
Data Transfer
◉ After connection is established, bidirectional data transfer can take place
◉ The client sends 2000 bytes of data in two segments.
◉ The server then sends 2000 bytes in one segment
◉ The data segments sent by the client have the PSH (push) flag set so that
the server TCP knows to deliver data to the server process as soon as they
are received
17
Data Transfer
◉ Urgent Data: This means that the sending application
program wants a piece of data to be read out of order by the
receiving application program.
◉ The solution is to send a segment with the URG bit set
18
Connection Termination
19
Error Control
◉ Error detection and correction in TCP is achieved through the use of
three simple tools: checksum, acknowledgment, and time-out.
20
WANT BIG IMPACT?
USE BIG IMAGE.
21
DESKTOP PROJECT
Show and explain your web,
app or software projects using
these gadget templates.
22