TCP Concepts Overview
- 27Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is the primary purpose of the TCP three-way handshake?
27 questions
- 1
What is the primary purpose of the TCP three-way handshake?
Model answer
The three-way handshake establishes a TCP connection by synchronizing sequence numbers between the two endpoints and confirming that each side is reachable and ready to communicate.
Explanation
During the handshake, the client sends a SYN to announce its initial sequence number, the server responds with SYN-ACK to acknowledge and offer its own ISN, and finally the client sends an ACK to complete synchronization.
- 2
Why is the first packet in a TCP connection called a SYN?
Model answer
It is called a SYN because it allows the two sides to synchronize their sequence numbers before data exchange begins.
Explanation
SYN stands for 'synchronize' and refers to the exchange of initial sequence numbers that enables reliable, ordered delivery of data.
- 3
What is an Initial Sequence Number (ISN) and how is it chosen?
Model answer
The ISN is the starting sequence number chosen by a TCP endpoint, randomly generated to be unique and unlikely to repeat on different connections in the near future.
Explanation
The ISN is a 32-bit random value that each side selects when initiating a connection. It provides the base from which all subsequent sequence numbers are incremented.
- 4
In the TCP handshake, what is the 'ghost byte'?
Model answer
The ghost byte is a conceptual byte that each SYN consumes, causing the receiver to increment its acknowledgment number by one even though no real payload data is sent.
Explanation
During the handshake, the receiver treats the SYN itself as if it were one byte of data, so the acknowledgment number becomes the sender's ISN plus one, confirming receipt of the SYN.
- 5
What information does a client learn from receiving a SYN-ACK during the handshake?
Model answer
The client learns that the server exists, is reachable, has available resources on the specified port, and has acknowledged the client's initial sequence number by incrementing it by one.
Explanation
The SYN-ACK also provides the server's own ISN, allows the client to estimate round-trip time, and optionally carries TCP options such as window scaling and MSS.
- 6
What are relative sequence numbers in Wireshark and why are they used?
Model answer
Relative sequence numbers are zero-based values calculated by Wireshark from the original raw sequence numbers, making it easier for humans to track data flow without dealing with large arbitrary values.
Explanation
Wireshark subtracts the initial sequence number of each side from all subsequent sequence numbers, showing them as starting at zero. This simplifies analysis because the numbers then directly reflect the byte count in each direction.
- 7
How does a sequence number increment when data is sent over TCP?
Model answer
For every byte of payload data sent, the sequence number increases by exactly one. If N bytes are sent, the sequence number in the next segment becomes current_seq + N.
Explanation
Sequence numbers count bytes of data, not packets. The initial sequence number represents the starting point; after sending N bytes, the next sequence number equals the previous sequence number plus N.
- 8
What is an acknowledgment number in TCP and how is it calculated when data is received?
Model answer
An acknowledgment number indicates the next expected byte from the sender. When a receiver gets N bytes starting at sequence X, it sends ACK with value X+N.
Explanation
The ACK number tells the sender what byte the receiver expects next, confirming all bytes up to that number have been received. For a SYN (ghost byte), the ACK is ISN + 1.
- 9
In the sequence number diagram from client to server, if the client sends a 501-byte GET request starting at sequence 1, what will be the client's next sequence number and what acknowledgment number should the server return?
Model answer
The client's next sequence number will be 502 (1+501), and the server's acknowledgment number should be 502 to confirm receipt of all 501 bytes.
Explanation
The sequence number advances by the number of payload bytes sent. The server ACKs the next expected byte, which is the first byte of the payload plus the length.
- 10
What is an ephemeral port and what typical range does it use?
Model answer
An ephemeral port is a high-numbered (above 1023 or 1024) temporary port chosen by the client as the source port for a TCP connection.
Explanation
Well-known services listen on low port numbers (e.g., 80 for HTTP), while clients use random ephemeral ports from the upper range to uniquely identify the connection.
- 11
What is a 'four-tuple' in TCP and how does it uniquely identify a connection?
Model answer
A four-tuple consists of the source IP, source port, destination IP, and destination port. This combination uniquely identifies a TCP conversation.
Explanation
In Wireshark, the stream index is assigned based on the four-tuple, allowing the tool to group all packets of the same TCP connection together.
- 12
How can you determine whether a Wireshark capture was taken on the client side or server side by looking at the handshake timing?
Model answer
On the client side, the time between SYN and SYN-ACK is the round-trip time (e.g., 20 ms), and the ACK follows very quickly (microseconds). On the server side, the SYN-ACK and ACK would show a similar delay
Explanation
The RTT is measured from the initial SYN to the SYN-ACK. The client sends the ACK immediately after receiving SYN-ACK, so the ACK appears with negligible delay from the client's perspective.
- 13
A packet shows a TTL of 238. If the starting TTL is likely 255, approximately how many hops has the packet traversed?
Model answer
The packet has likely traversed 17 hops (255−238=17).
Explanation
Each router decrements the TTL by one. Common initial TTL values are 64, 128, and 255. By subtracting the observed TTL from the initial value, you can estimate path length.
- 14
What is the TCP header length field and why is it significant in the handshake?
Model answer
The header length indicates the size of the TCP header in 32-bit words. It is larger in SYN packets (typically 44 bytes) to accommodate TCP options that are only exchanged during the handshake.
Explanation
The header length field is 4 bits, limiting the header to a maximum of 60 bytes. In the handshake, options like window scaling require extra space, increasing the header length.
- 15
Which TCP flags are considered the most important for day-to-day analysis?
Model answer
The six flags ACK, PUSH, RESET, SYN, FIN, and URG are most commonly used; ACK appears in every packet after the first SYN, and the others mark specific events like connection setup, teardown, or errors.
Explanation
Other flags like CWR, ECN, and NS are rarely seen. ACK, PUSH, RST, SYN, and FIN are the flags that analysts focus on for troubleshooting and security analysis.
- 16
In a TCP handshake, which packet has the ACK flag not set?
Model answer
Only the very first SYN packet does not have the ACK flag set. Every subsequent packet in the connection, including the SYN-ACK and third ACK, has the ACK flag set.
Explanation
The initial SYN has no data to acknowledge, so the ACK bit is 0. After that, the acknowledgment number becomes meaningful and is always present, making the ACK bit 1.
- 17
What is a 'reset' (RST) flag used for in TCP?
Model answer
A reset flag is used to abruptly terminate a connection or reject a connection request, often when a packet arrives for a closed port or a connection is in an invalid state.
Explanation
Resets are typically sent by the receiving host to indicate that it cannot process the packet. They can also be used by firewalls or load balancers to forcibly close connections.
- 18
What does the TCP receive window size represent and how many bytes are allocated in the header for it?
Model answer
The receive window size tells the sender how many bytes the receiver can buffer at once. The field is 2 bytes, limiting the maximum value to 65535 bytes before window scaling.
Explanation
The receiver advertises the available space in its receive buffer. The sender must not send more data than the window size until it receives acknowledgments that free up buffer space.
- 19
How does window scaling increase the effective window size beyond 65535 bytes?
Model answer
Window scaling uses a shift count (multiplier) exchanged in the SYN to multiply the raw window value by 2shift, allowing windows up to 1 GB.
Explanation
For example, a shift count of 6 means multiply by 64, so a raw window of 65535 becomes 4,194,240 bytes. The multiplier is agreed upon in the handshake and applies for the connection's lifetime.
- 20
Why is it important to capture the TCP handshake in a Wireshark trace?
Model answer
The handshake contains the negotiated TCP options (window scale, MSS, SACK) and the initial sequence numbers, which are needed to correctly interpret the calculated window size and other parameters throughout the connection.
Explanation
Without the handshake, Wireshark cannot determine the window scale multiplier, so it would show only the raw window size (e.g., 131 bytes) instead of the actual buffer space (e.g., 67,072 bytes).
- 21
What is 'calculated window size' in Wireshark and how does it differ from the raw window size?
Model answer
The calculated window size multiplies the raw window by the scaling factor (if enabled) to show the actual receive buffer space available. The raw window is the 2-byte field value before scaling.
Explanation
Wireshark computes the calculated window size only after the window scale option has been negotiated. It then adjusts every subsequent raw window value by that multiplier.
- 22
What does a 'zero window' indicate and why is it problematic?
Model answer
A zero window means the receiver's buffer is completely full, so it cannot accept any more data. The sender must stop transmitting until the receiver advertises a non-zero window.
Explanation
Zero window conditions can cause application-level stalls and are often a sign of a slow application consuming data too slowly or a network buffer that is not being drained efficiently.
- 23
What is Maximum Segment Size (MSS) and how is it advertised?
Model answer
MSS is the largest amount of payload data a device can receive in a single TCP segment. It is advertised in the SYN and SYN-ACK options as an advisory value, not negotiated.
Explanation
Each side sets its MSS based on the link layer MTU (typically 1460 bytes for Ethernet, 1440 for others). The sender should not exceed the receiver's MSS to avoid fragmentation.
- 24
What is Selective Acknowledgment (SACK) and why is it useful?
Model answer
SACK allows a receiver to inform the sender about exactly which segments have been received, so the sender only retransmits lost segments instead of all data after the first loss.
Explanation
Without SACK, a sender must retransmit from the first unacknowledged byte, even if later bytes were received. SACK improves efficiency in lossy networks.
- 25
What is an 'empty ACK' in TCP and how can you identify one in Wireshark?
Model answer
An empty ACK is a packet with TCP segment length zero; it carries no payload and exists solely to acknowledge received data. It can be identified by adding the 'TCP Segment Len' column.
Explanation
Empty ACKs are common and essential for flow control. They do not advance the sender's sequence number, only carry an acknowledgment number and possibly updates to the window size.
- 26
How can you filter for SYN packets in Wireshark using the display filter?
Model answer
Use the filter
tcp.flags.syn == 1to show all packets with the SYN flag set (both SYN and SYN-ACK).Explanation
Wireshark provides built-in display filter syntax for each TCP flag. This is useful for quickly isolating handshake packets or scanning for unusual SYN activity.
- 27
Why are newer protocols like QUIC being developed when TCP has been so successful for 40 years?
Model answer
TCP's header space for options is limited (due to the 4-bit header length field), and its connection establishment latency and head-of-line blocking make it less suitable for modern high-speed, encrypted web traffic.
Explanation
QUIC runs over UDP, avoids the handshake overhead and offers built-in encryption, multiplexing, and faster connection setup. It is designed to overcome TCP's limitations.

Ask anything
We've read this whole study set, so questions about it get the best answers.