Unit 1
Unit 1
Importance:
(ii) Push:
The Push flag is used to instruct the receiving TCP implementation to pass the data to
the application as soon as possible without waiting for more data to arrive. This is
beneficial in scenarios where the sender wants to ensure timely delivery of the data
to the application layer without introducing additional delays.
Importance:
(iii) Acknowledgment:
The Acknowledgment (ACK) flag is used to indicate that the Acknowledgment Number field
is significant. This field acknowledges receipt of data up to a specified sequence
number, acknowledging successful data reception.
Importance:
Note: In TCP, the ACK flag is almost always set (except for the initial SYN packet).
It plays a central role in acknowledging data receipt and ensuring reliable
communication.
In summary, these TCP header flags contribute to the flexibility, reliability, and
efficiency of communication over TCP. They enable the protocol to adapt to various
application requirements and ensure the timely and orderly delivery of data.
The 3-way handshake is a process used by TCP to establish a reliable and orderly
connection between two devices. It involves three steps: SYN, SYN-ACK, and ACK. Here's
a simple diagram to illustrate the 3-way handshake technique:
Client Server
| |
| SYN (Seq=100) |
|----------------------->| Step 1: Client initiates the connection by sending
a SYN packet with an initial sequence number (Seq=100).
| |
| |
| SYN-ACK (Seq=300, |
| Ack=101) |
|<-----------------------| Step 2: Server responds with a SYN-ACK packet,
acknowledging the client's request. The server also sends its own initial sequence
number.
| |
| |
| ACK (Seq=101, |
| Ack=301) |
|----------------------->| Step 3: Client acknowledges the server's response,
completing the 3-way handshake. The connection is now established.
| |
1. Step 1 (Client to Server): The client initiates the connection by sending a TCP
packet with the SYN (synchronize) flag set and an initial sequence number
(Seq=100). This indicates the client's desire to establish a connection and its
chosen starting sequence number.
2. Step 2 (Server to Client): The server receives the SYN packet, acknowledges the
client's request, and responds with a SYN-ACK packet. The server also chooses
its own initial sequence number (Seq=300) and acknowledges the client's
sequence number (Ack=101). This step indicates that the server is willing to
establish a connection.
3. Step 3 (Client to Server): The client receives the SYN-ACK packet, acknowledges
the server's sequence number (Ack=301), and completes the 3-way handshake by
sending an ACK packet. The acknowledgment indicates that the client is ready
for data transfer, and the connection is now established.
After the 3-way handshake, both the client and server are synchronized and have agreed
on initial sequence numbers. They can now exchange data in a reliable and orderly
manner.
1. Normal Acknowledgment:
Sender Receiver
| |
|--- Data Packet |
| |
| |
| |
| |
|<-- ACK Packet --|
2. Lost Acknowledgment:
Sender Receiver
| |
|--- Data Packet |
| |
| |
| |
| |
| | [ACK Packet lost in transit]
|<-- Timeout & ---|
| Retransmit |
|--- Data Packet |
| |
| |
|<-- ACK Packet --|
Explanation:
The sender sends a data packet, and the receiver acknowledges it with an ACK
packet.
In the case of a lost ACK, the sender doesn't receive the acknowledgment.
The sender waits for a timeout period. If no acknowledgment is received within
this time, it assumes the ACK was lost.
The sender retransmits the original data packet, and the receiver sends the
acknowledgment when the retransmitted packet is received.
Sender Receiver
| |
|--- Data Packet |
| Seq=100 |
| |
| |
| |
|<-- ACK Seq=200 --|
Sender Receiver
| |
|--- Data Packet |
| Seq=200 |
| |
| |
| |
|<-- ACK Seq=100 --|
Sender Receiver
| |
| |
|<-- ACK Seq=200 --|
|--- Data Packet |
| Seq=100 |
| |
Explanation:
3. Flow Control:
5. Full-Duplex Communication:
TCP ensures that data is delivered in the order it was sent, preventing
out-of-order delivery to the application layer.
1. Ordered Delivery:
2. Retransmission:
3. Flow Control:
Sender Receiver
| |
|--- Data Packet |
| Seq=100 |
| |
| |
| |
|<-- ACK Seq=200 --|
2. Out-of-Order Data Arrival:
Sender Receiver
| |
|--- Data Packet |
| Seq=200 |
| |
| |
| |
|<-- ACK Seq=100 --|
Sender Receiver
| |
| |
|<-- ACK Seq=200 --|
|--- Data Packet |
| Seq=100 |
| |
Explanation:
In summary, the sequence numbers in TCP segments play a crucial role in ensuring the
ordered delivery of data and facilitate reliable communication by allowing the
detection and correction of out-of-order segments through acknowledgment and
retransmission mechanisms.
Components of IP Header:
The IP (Internet Protocol) header contains several fields that provide essential
information for the delivery of IP packets. The main components include:
3. Type of Service (ToS): Defines the quality of service for the packet, including
priority and handling instructions.
4. Total Length: Represents the total length of the IP packet, including both the
header and the data.
6. Flags: Flags used for fragmentation control (e.g., Don't Fragment, More
Fragments).
7. Fragment Offset: Indicates the position of the fragment in the original
datagram. Crucial for reassembling fragmented packets.
8. Time-to-Live (TTL): Specifies the maximum number of hops a packet can traverse
before being discarded.
9. Protocol: Identifies the protocol of the next-layer protocol (e.g., TCP, UDP).
11. Source and Destination IP Addresses: Specify the source and destination
addresses of the IP packet.
2. Internet Layer:
Uses the Internet Protocol (IP) for routing and forwarding packets
between networks.
3. Transport Layer:
4. Application Layer:
Differences:
The TCP/IP model has four layers, while the OSI model has seven layers.
The layers in the TCP/IP model are Link, Internet, Transport, and Application,
which correspond roughly to the Data Link, Network, Transport, Session,
Presentation, and Application layers in the OSI model.
The TCP/IP model was developed based on real-world implementation experience,
while the OSI model was designed as a theoretical model.
Layer Diagrams:
TCP/IP Model:
+------------------------------------+
| Application Layer |
+------------------------------------+
| Transport Layer |
+------------------------------------+
| Internet Layer |
+------------------------------------+
| Link (Network Interface) |
+------------------------------------+
OSI Model:
+------------------------------------+
| Application Layer |
+------------------------------------+
| Presentation Layer |
+------------------------------------+
| Session Layer |
+------------------------------------+
| Transport Layer |
+------------------------------------+
| Network Layer |
+------------------------------------+
| Data Link Layer |
+------------------------------------+
| Physical Layer |
+------------------------------------+