WalzoneInterview Prep
📞 Interviewing soon? Practice with a realistic AI mock phone interview — it calls you, then scores you. First 15 min FREE →

Computer Networking · Intermediate · question 25 of 100

Can you describe the basic process of the three-way handshake in TCP connections?

📕 Buy this interview preparation book: 100 Computer Networking questions & answers — PDF + EPUB for $5

Sure! The three-way handshake is the process used by TCP (Transmission Control Protocol) to establish a connection between two hosts. It’s called a "three-way" handshake because it involves three messages exchanged between the two hosts. The basic process of the three-way handshake is as follows:

1. SYN: The initiating host sends a SYN (synchronize) message to the other host. This message includes a randomly generated sequence number that is used to keep track of which messages have been sent and received.

2. SYN-ACK: The receiving host responds with a SYN-ACK (synchronize-acknowledge) message. This message includes its own randomly generated sequence number, as well as an acknowledgement number that is one greater than the initiating host’s sequence number. This acknowledges receipt of the SYN message and initializes the connection.

3. ACK: The initiating host responds with an ACK (acknowledge) message. This message includes the acknowledgement number that the receiving host sent in the SYN-ACK message. This acknowledges receipt of the SYN-ACK message and completes the three-way handshake.

Once the three-way handshake is complete, TCP has established a reliable connection between the two hosts. Both hosts can now start sending data to each other, and TCP guarantees that the data will be delivered in the correct order and without errors.

Here is an example of the three-way handshake in action:

1. The initiating host (let’s call it Host A) sends a SYN message to the receiving host (Host B). The sequence number in the SYN message is, say, 100.

2. Host B responds with a SYN-ACK message. The sequence number in the SYN-ACK message is, say, 200 (randomly generated by Host B), and the acknowledgement number is 101 (Host A’s sequence number plus one).

3. Host A responds with an ACK message. The acknowledgement number in the ACK message is 201 (Host B’s sequence number plus one).

At this point, the three-way handshake is complete, and Host A and Host B can start sending data to each other over the TCP connection.

Reading is step one. Saying it out loud is the interview. Our AI interviewer calls your phone and runs a realistic Computer Networking interview — then scores it.
📞 Practice Computer Networking — free 15 min
📕 Buy this interview preparation book: 100 Computer Networking questions & answers — PDF + EPUB for $5

All 100 Computer Networking questions · All topics