TCP Protocol Explained: Segment Format, Connection Establishment & Termination

COMPUTER NETWORKS - CHAPTER 30
TCP Protocol Explained: Segment Format, Connection Establishment and Termination
Imagine you are downloading an important PDF.

If one small part of the file disappears on the way, you do not want the final PDF to contain missing pages or corrupted data.

This is where TCP becomes useful. TCP keeps track of bytes, acknowledges received data, retransmits missing data and manages a logical connection between the two applications.
TCP Transmission Control Protocol
Transport Layer Process-to-process service
20 Bytes Minimum TCP header
Connection-Oriented Reliable ordered byte stream
Direct Answer

TCP or Transmission Control Protocol is a connection-oriented Transport Layer protocol that provides reliable and ordered byte-stream communication between application processes.

A TCP segment contains a TCP header followed by data. Important header fields include source port, destination port, sequence number, acknowledgement number, data offset, control flags, window size, checksum, urgent pointer and optional fields.

TCP normally establishes a connection using a three-way handshake and closes the two communication directions using FIN and ACK exchanges.

What Is TCP?

TCP Protocol Explained: Segment Format, Connection Establishment & Termination

TCP stands for:

Transmission Control Protocol

TCP is one of the main Transport Layer protocols used in TCP/IP networks.

Its job is not simply to send data.

TCP tries to make sure that data reaches the receiving application:

  • Reliably
  • In the correct order
  • Without accidental duplication
  • At a rate the receiver can handle
Simple Definition: TCP is a connection-oriented Transport Layer protocol that provides reliable and ordered communication between applications.

Where Does TCP Work?

Application Layer
TCP - Transport Layer
IP - Internet / Network Layer
Data Link Layer

Main Features of TCP

Connection-Oriented TCP establishes a logical connection before normal data transfer.
Reliable Missing data can be retransmitted.
Ordered Delivery Sequence numbers help restore data in the correct byte order.
Full Duplex Both endpoints can send and receive data.
Byte Stream TCP treats application data as a continuous stream of bytes.
Flow Control Receiver window information helps prevent receiver overflow.
Error Detection TCP includes a checksum.
Congestion Control TCP adjusts sending behaviour when the network becomes congested.
Port Addressing Source and destination ports identify applications.

How TCP Works

TCP communication can be understood in three major stages.

1. Establish Create the TCP connection.
2. Transfer Send bytes reliably in both directions.
3. Terminate Close the TCP connection safely.
TCP Life Cycle: Connection Setup -> Data Transfer -> Connection Close

What Is a TCP Segment?

The Transport Layer protocol data unit of TCP is normally called a:

TCP Segment

A TCP segment contains:

TCP HEADER
Minimum 20 Bytes
APPLICATION DATA
Variable Length
TCP Segment = TCP Header + TCP Data

TCP Segment Format

The TCP header is arranged in 32-bit rows.

The minimum TCP header is:

20 bytes

With options, the header can grow up to:

60 bytes
TCP Header Pictorial Format
Traditional university-textbook layout. The classic six TCP control flags are shown together. Modern TCP also uses ECN-related ECE and CWR control bits.
0 4 8 12 16 20 24 31
Source Port 16 bits
Destination Port 16 bits
Sequence Number 32 bits
Acknowledgement Number 32 bits
Data Offset 4 bits
Reserved Textbook field
Control Flags URG ACK PSH RST SYN FIN
Window Size 16 bits
Checksum 16 bits
Urgent Pointer 16 bits
Options Variable
Padding As required
Application Data TCP Payload
Source Port 16 bits Identifies the sending application endpoint.
Destination Port 16 bits Identifies the destination application endpoint.
Sequence Number 32 bits Identifies the byte position represented by the segment.
Acknowledgement Number 32 bits Indicates the next byte expected.
Data Offset 4 bits Gives the TCP header length.
Flags Controls connection setup, acknowledgement, reset and termination behaviour.
Window 16 bits Advertises receiver space.
Checksum 16 bits Detects transmission corruption.
Urgent Pointer 16 bits Used when urgent data signalling is active.

Source Port and Destination Port

Both port fields are 16 bits long.

The source port identifies the sending process, while the destination port identifies the receiving service or process.

Port Values = 0 to 65,535

Example

A browser may create a connection such as:

Client: 192.0.2.10 : 53000

Server: 198.51.100.20 : 443

The client uses a temporary source port, while the HTTPS server commonly listens on port 443.

TCP Sequence Number

TCP does not number complete messages.

TCP numbers the bytes in its byte stream.

The Sequence Number field is 32 bits long.

For a segment carrying data, the sequence number normally identifies the number of the first data byte contained in that segment.

Example TCP Byte Stream
5000 Byte A
5001 Byte B
5002 Byte C
5003 Byte D
5004 Byte E
Sequence Number Trick: It tells where the first byte of this TCP data belongs in the byte stream.

SYN and FIN Also Consume Sequence Space

A SYN flag used during connection establishment consumes one sequence number.

A FIN used to close a sending direction also consumes one sequence number.

TCP Acknowledgement Number

The Acknowledgement Number field is also 32 bits.

It normally means:

The next byte that the receiver expects.

Example

Suppose the receiver has correctly received bytes 1000 through 1499.

Received
1000 - 1199
Received
1200 - 1499
Next Expected
1500
ACK Number = 1500

TCP acknowledgement is normally cumulative.

An ACK of 1500 tells the sender that the receiver expects byte 1500 next.

TCP Data Offset Field

Data Offset tells the receiver where the TCP data begins.

It therefore gives the TCP header length.

Just like IPv4 IHL, TCP Data Offset is measured in:

32-bit words
TCP Header Size = Data Offset x 4 bytes
Offset = 5 5 x 4 = 20 bytes
Minimum TCP header
Offset = 8 8 x 4 = 32 bytes
Offset = 15 15 x 4 = 60 bytes
Maximum header
Offset Trick: Data Offset x 4 = TCP Header Bytes

TCP Control Flags

TCP flags control important TCP actions.

The six classic flags commonly shown in university TCP-header diagrams are:

Classic TCP Control Flags
URG Urgent Pointer valid
ACK Acknowledgement field valid
PSH Push indication
RST Reset connection
SYN Synchronize sequence state
FIN Finished sending

SYN

SYN is used during TCP connection establishment.

ACK

ACK indicates that the Acknowledgement Number field contains valid acknowledgement information.

FIN

FIN tells the peer that this endpoint has finished sending data in that direction.

RST

RST immediately resets or rejects a TCP connection.

PSH

PSH is a delivery hint associated with pushing received data toward the application instead of unnecessarily waiting for more buffering.

URG

URG indicates that the Urgent Pointer field is meaningful.

Modern TCP Note: Modern TCP headers also use ECN-related control bits such as ECE and CWR. Many university diagrams still focus on the six classic flags because those are the flags most often asked in introductory exams.

TCP Window Size

The Window Size field is used for TCP flow control.

The receiver tells the sender how much additional receive space it can accept.

1
2
3
4
5
6
7
8
Receiver currently allows the sender to send into the advertised window.

The base Window field is 16 bits.

Maximum unscaled value = 65,535

The TCP Window Scale option can be negotiated to support much larger effective receive windows.

Flow Control Trick: Receiver Window protects the receiver from receiving too much data too quickly.

TCP Checksum

The TCP Checksum is 16 bits.

It is used to detect corruption affecting the TCP segment.

The calculation covers more than just the visible TCP header.

IP Pseudo Header
Source, destination and protocol-related information
TCP Header
TCP Data
One's-complement checksum calculation
Important: The pseudo header is used in the TCP checksum calculation, but it is not transmitted as part of the TCP header itself.

Urgent Pointer

The Urgent Pointer field contains 16 bits.

It is interpreted when the URG control flag is active.

Urgent-data mechanisms are uncommon in many modern applications, but the field remains important for TCP-header questions.

TCP Options and Padding

TCP can include optional information after the fixed header fields.

MSS Maximum Segment Size communicates the largest TCP payload the sender is prepared to receive in a segment.
Window Scale Allows effective receive windows larger than 65,535 bytes.
SACK Permitted Allows use of Selective Acknowledgement capabilities.
Timestamp Can help with timing measurements and protection against certain old duplicate segments.

Padding is added when necessary so the TCP header ends on a 32-bit boundary.

TCP Is a Byte-Stream Protocol

TCP does not preserve application message boundaries.

If an application writes:

100 bytes
then 200 bytes

the receiving application should not assume TCP will necessarily deliver those bytes as exactly two separate reads of 100 and 200 bytes.

TCP presents an ordered stream of bytes.

Very Important: TCP guarantees an ordered byte stream, not application-message boundaries.

How TCP Provides Reliability

Sequence Numbers
Track byte positions.
Acknowledgements
Confirm received byte ranges.
Timers
Detect likely loss.
Retransmission
Resend missing data.

Duplicate Detection

Sequence numbers also help TCP identify duplicate data.

Out-of-Order Data

TCP can hold received data while waiting for missing earlier bytes so the application receives the stream in order.

Retransmission Timeout

If acknowledgement for outstanding data does not arrive within the calculated retransmission timeout, TCP may retransmit the missing data.

Fast Retransmission

Repeated duplicate acknowledgements can indicate that a segment was lost even before the retransmission timer expires.

Traditional explanations often describe retransmission after three duplicate ACKs, although real modern TCP implementations use more detailed algorithms.

TCP Flow Control

The receiver may not be able to process incoming data as quickly as the sender can generate it.

TCP therefore uses receiver-advertised window information.

rwnd = Receiver Window

If receiver buffer space becomes smaller, the advertised receive window can decrease.

Main Purpose: TCP Flow Control protects the receiving endpoint.

TCP Flow Control vs Congestion Control

Flow Control

Protects the receiver.

Uses receiver-advertised capacity such as rwnd.

Congestion Control

Protects the network from excessive traffic.

TCP maintains congestion-related sending limits such as a congestion window.

Practical sending limit is influenced by both receiver capacity and congestion-control limits.
Easy Trick: Flow Control = Receiver problem
Congestion Control = Network problem

TCP MSS and MTU

MSS means:

Maximum Segment Size

MSS describes TCP payload size, not the complete IP packet size.

IP Header
TCP Header
TCP Data = MSS

Common IPv4 Example

Suppose:

Ethernet MTU = 1500 bytes
IPv4 Header = 20 bytes
TCP Header = 20 bytes
MSS = 1500 - 20 - 20
MSS = 1460 bytes
Common Ethernet IPv4 TCP MSS = 1460 bytes when there are no extra IP or TCP header options.

TCP Connection Management

TCP is connection-oriented.

Before normal data transfer, both endpoints create and synchronize connection state.

Connection management has three major parts:

  1. Connection establishment
  2. Data transfer
  3. Connection termination

TCP Three-Way Handshake

TCP normally establishes a connection using three control exchanges.

Let:

Client Initial Sequence Number = x
Server Initial Sequence Number = y
CLIENT
trace
SERVER
CLOSED
then SYN-SENT
SYN, Seq = x
SYN + ACK, Seq = y, Ack = x + 1
ACK, Ack = y + 1
LISTEN
then SYN-RECEIVED
Step 1 - SYN Client requests a connection and sends its initial sequence number.
Step 2 - SYN + ACK Server acknowledges the client's SYN and sends its own SYN.
Step 3 - ACK Client acknowledges the server's SYN.
Handshake Trick: SYN -> SYN-ACK -> ACK

Why Does TCP Need a Three-Way Handshake?

It confirms that the server can receive communication from the client.
It confirms that the client can receive communication from the server.
Both endpoints exchange and acknowledge initial sequence-number information.
It helps TCP avoid confusing old duplicate connection requests with a valid new connection.
Why is a two-way handshake not enough?

Because both sides must confirm each other's initial sequence information and verify two-way communication state. The final ACK confirms that the client received the server's SYN information.

Solved TCP Handshake Sequence Example

Suppose:

Client ISN = 1000
Server ISN = 5000

Step 1

Client sends SYN
Sequence = 1000

Step 2

Server sends SYN + ACK
Sequence = 5000
ACK = 1001

Step 3

Client sends ACK
ACK = 5001
Why +1? Because SYN consumes one sequence number.

TCP Data Transfer After the Handshake

After both endpoints reach the ESTABLISHED state, application data can flow.

TCP uses:

  • Sequence numbers
  • Acknowledgement numbers
  • Receive windows
  • Checksums
  • Retransmission timers
  • Congestion-control algorithms

Simple Data Example

Suppose a TCP segment begins with:

Sequence Number = 1001
Data Length = 500 bytes

The data covers bytes:

1001 through 1500

The receiver can acknowledge:

ACK = 1501

TCP Connection Termination

TCP provides full-duplex communication.

This means each direction can be closed separately.

A common orderly TCP close therefore uses four control exchanges.

HOST A
Active Closer
FIN, Seq = u
ACK = u + 1
FIN, Seq = v
ACK = v + 1
HOST B
Passive Closer

Step 1 - First FIN

Host A says:

I have finished sending data.

Step 2 - ACK

Host B acknowledges Host A's FIN.

Step 3 - Second FIN

When Host B has also finished sending, it sends its own FIN.

Step 4 - Final ACK

Host A acknowledges Host B's FIN.

Normal TCP Close Trick: FIN -> ACK -> FIN -> ACK
Important: FIN also consumes one TCP sequence number. Therefore the acknowledgement of a FIN normally advances by one.

TCP Half-Close

Because TCP is full duplex, one endpoint can finish sending while still receiving data from the other side.

For example:

Host A sends FIN.

Host A cannot send more application data after that direction closes.

Host B may still send remaining data until it also sends FIN.

This condition is called a:

TCP Half-Close

Why Does TCP Use TIME-WAIT?

The endpoint that actively closes a TCP connection normally enters the TIME-WAIT state after sending the final ACK.

TIME-WAIT helps old delayed segments disappear before the same connection identification is reused.

It also lets the endpoint send the final ACK again if the peer retransmits its FIN.

Textbooks often describe TIME-WAIT duration using the concept of 2 x MSL, where MSL means Maximum Segment Lifetime. Actual operating-system timers can vary.

TCP RST - Resetting a Connection

RST
TCP RST is used to abort, reject or reset a TCP connection instead of closing it through the normal FIN sequence.

Examples can include:

  • Connecting to a TCP port where no service is listening.
  • Aborting an existing TCP connection.
  • Rejecting invalid TCP state.
FIN: Graceful close.
RST: Abrupt reset.

Important TCP Connection States

TCP maintains state because it is a connection-oriented protocol.

CLOSED -> SYN-SENT -> ESTABLISHED -> FIN-WAIT-1 -> FIN-WAIT-2 -> TIME-WAIT -> CLOSED

Common Server States

CLOSED -> LISTEN -> SYN-RECEIVED -> ESTABLISHED

Other Important States

  • CLOSE-WAIT
  • LAST-ACK
  • CLOSING

TCP vs UDP

Point TCP UDP
Full Form Transmission Control Protocol User Datagram Protocol
Connection Connection-oriented Connectionless
Reliability Provides reliability mechanisms No TCP-style reliability
Ordering Ordered byte stream Datagrams remain separate
Minimum Header 20 bytes 8 bytes
Handshake Connection setup required No TCP three-way handshake
Sequence Numbers Yes No TCP sequence-number mechanism
ACK Used for reliable delivery No TCP-style ACK system
Flow Control Yes No TCP-style receive-window flow control
Common Uses Web, file transfer, email and reliable streams DNS, streaming scenarios, gaming and applications needing low overhead

Solved TCP Numericals

Numerical 1: TCP Header Size

Given:

Data Offset = 7
Header Size = 7 x 4
= 28 bytes
Answer = 28 bytes

Numerical 2: Next ACK Number

A TCP segment has:

Sequence Number = 4000
TCP Data = 600 bytes

Data bytes are:

4000 through 4599

Next expected byte:

4600
ACK = 4600

Numerical 3: SYN Acknowledgement

Client sends:

SYN
Sequence = 9000

Server acknowledges:

ACK = 9001
Reason: SYN consumes one sequence number.

Numerical 4: FIN Acknowledgement

Suppose FIN uses:

Sequence = 7500

The peer acknowledges:

ACK = 7501

Numerical 5: Common TCP MSS

MTU = 1500
IPv4 Header = 20
TCP Header = 20
MSS = 1500 - 20 - 20
= 1460 bytes

Numerical 6: Maximum Basic Window Field

The basic TCP Window field contains:

16 bits
Maximum value = 2^16 - 1
= 65,535
Answer = 65,535 before applying negotiated window scaling.

Numerical 7: Handshake Sequence Numbers

Given:

Client ISN = 300
Server ISN = 800

The connection-establishment numbers are:

Client SYN: Seq = 300
Server SYN-ACK: Seq = 800, Ack = 301
Client ACK: Ack = 801

TCP Remember Tricks

TCP Nature: Connection-Oriented + Reliable + Ordered Byte Stream
Minimum Header: 20 bytes
Maximum Header: 60 bytes
Ports: Source Process + Destination Process
Sequence Number: First data byte number
ACK: Next byte expected
Data Offset: Offset x 4 = TCP header bytes
Handshake: SYN -> SYN-ACK -> ACK
Normal Close: FIN -> ACK -> FIN -> ACK
SYN and FIN: Each consumes one sequence number.
Flow Control: Protect receiver.
Congestion Control: Protect network.

Common TCP Exam Mistakes

1. TCP is connectionless.

Wrong. TCP is connection-oriented.
2. TCP header is always 20 bytes.

Wrong. 20 bytes is the minimum. TCP options can increase the header size up to 60 bytes.
3. Sequence number identifies the complete TCP segment number.

Wrong. TCP sequence numbers are related to byte positions in the TCP stream.
4. ACK number tells the last byte received.

TCP ACK normally indicates the next byte expected.
5. SYN does not consume sequence space.

Wrong. SYN consumes one sequence number.
6. FIN does not affect sequence numbers.

Wrong. FIN also consumes one sequence number.
7. TCP uses a two-way handshake.

Wrong. Normal TCP connection establishment uses a three-way handshake.
8. TCP always closes using only FIN and ACK once.

Because TCP is full duplex, each direction normally closes separately, commonly resulting in FIN, ACK, FIN, ACK exchanges.
9. TCP flow control and congestion control are the same.

Wrong. Flow control protects the receiver; congestion control responds to network congestion.
10. MSS means complete IP packet size.

Wrong. MSS refers to TCP payload size.
11. TCP preserves application message boundaries.

Wrong. TCP provides a byte stream.
12. TCP checksum checks the TCP header only.

Wrong. TCP checksum covers TCP header and TCP data and uses an IP pseudo header in its calculation.
13. RST and FIN mean the same thing.

Wrong. FIN is used for orderly shutdown, while RST is used for an abrupt reset.
14. TIME-WAIT means TCP is transferring normal application data.

Wrong. TIME-WAIT is associated with connection shutdown and protection against delayed old segments.

40 Important TCP Questions With Answers

1. What is TCP?
TCP is Transmission Control Protocol, a connection-oriented Transport Layer protocol that provides reliable and ordered byte-stream communication.
2. Which layer does TCP work at?
TCP works at the Transport Layer.
3. Is TCP connection-oriented?
Yes. TCP establishes connection state before normal data transfer.
4. What is a TCP segment?
A TCP segment is a Transport Layer data unit containing a TCP header and optional application data.
5. What is the minimum TCP header size?
20 bytes.
6. What is the maximum TCP header size?
60 bytes because the 4-bit Data Offset field can represent a maximum value of 15 32-bit words.
7. What is the size of the source port field?
16 bits.
8. What is the purpose of the destination port?
It identifies the receiving application or service endpoint.
9. What is the size of the TCP Sequence Number field?
32 bits.
10. What does the TCP Sequence Number normally identify?
It normally identifies the byte number of the first data byte contained in the segment.
11. What is the size of the Acknowledgement Number field?
32 bits.
12. What does TCP ACK number mean?
It normally indicates the next byte the receiver expects.
13. What is TCP Data Offset?
Data Offset specifies TCP header length in units of 32-bit words.
14. If Data Offset is 6, what is the TCP header size?
6 x 4 = 24 bytes.
15. Name the six classic TCP flags.
URG, ACK, PSH, RST, SYN and FIN.
16. What is SYN used for?
SYN is used during connection establishment to synchronize TCP sequence-number state.
17. What is FIN used for?
FIN indicates that an endpoint has finished sending data in one direction.
18. What is RST?
RST resets, aborts or rejects a TCP connection.
19. What is the TCP Window field?
It advertises how much receive space the receiver currently allows for flow control.
20. What is the maximum basic 16-bit TCP Window value?
65,535 before applying negotiated window scaling.
21. What is the TCP checksum used for?
It is used to detect corruption affecting the TCP header and data.
22. What is a TCP pseudo header?
It is IP-layer information included in the TCP checksum calculation but not transmitted as part of the TCP header.
23. What is MSS?
MSS means Maximum Segment Size and describes the maximum TCP payload size an endpoint advertises it is prepared to receive.
24. What is the common TCP MSS with 1500-byte Ethernet MTU and basic IPv4 and TCP headers?
1500 - 20 - 20 = 1460 bytes.
25. How does TCP establish a connection?
TCP normally establishes a connection using SYN, SYN-ACK and ACK.
26. What is the first step of the TCP handshake?
The initiating endpoint sends a SYN.
27. What does the server send in the second handshake step?
The server normally sends SYN plus ACK.
28. Why does SYN acknowledgement use x + 1?
Because SYN consumes one sequence number.
29. Why is the third ACK required?
It confirms that the client received and accepted the server's SYN and sequence-number information.
30. What is the ESTABLISHED state?
It is the TCP state in which the connection is open for normal data transfer.
31. How is a TCP connection normally terminated?
A normal full-duplex close commonly uses FIN, ACK, FIN and ACK exchanges.
32. Does FIN consume a sequence number?
Yes. FIN consumes one sequence number.
33. What is TCP half-close?
It is a state where one endpoint has stopped sending but can still receive data from the peer.
34. What is TIME-WAIT?
It is a state normally entered by the active closer to allow delayed old segments to expire and to support retransmission of the final ACK if needed.
35. What is the difference between FIN and RST?
FIN performs an orderly shutdown of one sending direction, while RST abruptly resets the connection.
36. How does TCP provide ordered delivery?
TCP uses byte sequence numbers and buffers out-of-order data until missing earlier bytes are received.
37. What is TCP flow control?
TCP flow control uses receiver-advertised window information to prevent the sender from overwhelming the receiver.
38. What is the difference between flow control and congestion control?
Flow control protects the receiver, while congestion control responds to limits and congestion inside the network.
39. Does TCP preserve application message boundaries?
No. TCP provides an ordered stream of bytes.
40. Give the easiest TCP memory line.
TCP means connect first, number the bytes, acknowledge received data, retransmit missing data and close both directions safely.

20 TCP Protocol MCQs With Answers

1. TCP stands for:

A. Transfer Control Process
B. Transmission Control Protocol
C. Transport Communication Process
D. Transmission Channel Protocol

Answer: B
2. TCP is:

A. Connectionless
B. Connection-oriented
C. Data Link protocol
D. Routing algorithm

Answer: B
3. Minimum TCP header size is:

A. 8 bytes
B. 16 bytes
C. 20 bytes
D. 40 bytes

Answer: C - 20 bytes
4. Maximum TCP header size is:

A. 40 bytes
B. 60 bytes
C. 64 bytes
D. 128 bytes

Answer: B - 60 bytes
5. Source Port field is:

A. 8 bits
B. 16 bits
C. 32 bits
D. 64 bits

Answer: B
6. TCP Sequence Number is:

A. 8 bits
B. 16 bits
C. 32 bits
D. 128 bits

Answer: C
7. TCP acknowledgement normally indicates:

A. Previous packet number only
B. Next byte expected
C. Router address
D. MAC address

Answer: B
8. Which flag starts TCP connection establishment?

A. FIN
B. SYN
C. RST
D. URG

Answer: B - SYN
9. TCP three-way handshake is:

A. SYN, SYN-ACK, ACK
B. FIN, ACK, FIN
C. ACK, ACK, ACK
D. SYN, FIN, RST

Answer: A
10. SYN consumes:

A. No sequence number
B. One sequence number
C. Two sequence numbers
D. 32 sequence numbers

Answer: B
11. FIN is mainly used for:

A. Connection termination
B. Routing
C. Fragmentation
D. DNS resolution

Answer: A
12. RST means:

A. Reset connection
B. Reliable Segment Transfer
C. Routing State Table
D. Receiver Sequence Timer

Answer: A
13. Data Offset tells:

A. IP address size
B. TCP header length
C. Ethernet frame length
D. Number of routers

Answer: B
14. If Data Offset is 5, TCP header is:

A. 5 bytes
B. 10 bytes
C. 20 bytes
D. 40 bytes

Answer: C
15. TCP Window field provides:

A. Flow control information
B. DNS mapping
C. IP routing
D. MAC addressing

Answer: A
16. TCP checksum is:

A. Optional in TCP
B. Used for error detection
C. Used only for routing
D. Same as TTL

Answer: B
17. TCP provides:

A. Message-boundary preservation
B. Ordered byte stream
C. Only multicast
D. Connectionless datagrams

Answer: B
18. Which state represents an active TCP connection?

A. ESTABLISHED
B. CLOSED only
C. LISTEN only
D. TIME-WAIT only

Answer: A
19. A normal TCP full-duplex close commonly uses:

A. SYN, SYN, ACK
B. FIN, ACK, FIN, ACK
C. RST only always
D. UDP ACK

Answer: B
20. With MTU 1500, IPv4 header 20 and TCP header 20, MSS is:

A. 1400 bytes
B. 1440 bytes
C. 1460 bytes
D. 1500 bytes

Answer: C - 1460 bytes

Frequently Asked Questions

What is TCP in simple words?

TCP is a Transport Layer protocol that creates a connection and provides reliable, ordered byte-stream communication between applications.

What is a TCP segment?

A TCP segment contains a TCP header and optional application data.

What is the minimum TCP header size?

The minimum TCP header size is 20 bytes.

What is the maximum TCP header size?

The maximum TCP header size is 60 bytes.

What does the TCP Sequence Number mean?

It normally identifies the number of the first data byte carried by a TCP segment.

What does the TCP ACK number mean?

It normally indicates the next byte the receiver expects.

What is the TCP three-way handshake?

TCP connection establishment normally uses SYN, SYN-ACK and ACK.

Why does SYN increase acknowledgement by one?

Because SYN consumes one TCP sequence number.

How does TCP terminate a connection?

A normal full-duplex connection close commonly uses FIN, ACK, FIN and ACK exchanges because each direction closes independently.

What is TCP TIME-WAIT?

TIME-WAIT is a connection-closing state that helps delayed old TCP segments expire and allows the final ACK to be retransmitted if the peer repeats its FIN.

What is the difference between FIN and RST?

FIN closes one sending direction in an orderly manner, while RST abruptly resets the TCP connection.

What is TCP MSS?

MSS is Maximum Segment Size and normally represents the maximum TCP payload size an endpoint advertises it can receive.

Does TCP preserve message boundaries?

No. TCP provides an ordered byte stream, so application message boundaries are not preserved automatically.

What is TCP flow control?

TCP flow control uses the receiver's advertised window to help prevent a sender from overflowing the receiver's buffer.

TCP Quick Revision
Full Form: Transmission Control Protocol
Layer: Transport Layer
Nature: Connection-oriented
Service: Reliable ordered byte stream
Minimum Header: 20 bytes
Maximum Header: 60 bytes
Port Fields: 16 bits each
Sequence Number: 32 bits
ACK Number: 32 bits
Window: Flow control
Checksum: Error detection
SYN: Connection setup
FIN: Graceful direction close
RST: Abrupt reset
Handshake: SYN -> SYN-ACK -> ACK
Normal Close: FIN -> ACK -> FIN -> ACK
SYN and FIN: Consume one sequence number
TIME-WAIT: Protects connection shutdown from delayed old segments

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Join Telegram Exam updates and free resources