0
0
Computer Networksknowledge~10 mins

Three-way handshake in Computer Networks - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Three-way handshake
Client sends SYN
Server receives SYN
Server sends SYN-ACK
Client receives SYN-ACK
Client sends ACK
Server receives ACK
Connection Established
The three-way handshake is a process where the client and server exchange three messages (SYN, SYN-ACK, ACK) to establish a reliable connection.
Execution Sample
Computer Networks
Client -> Server: SYN
Server -> Client: SYN-ACK
Client -> Server: ACK
This sequence shows the three messages exchanged to start a TCP connection.
Analysis Table
StepMessage SentSenderReceiverPurposeState After
1SYNClientServerRequest connectionSYN sent
2SYN-ACKServerClientAcknowledge SYN and send own SYNSYN-ACK sent
3ACKClientServerAcknowledge SYN-ACKConnection established
4----Handshake complete, ready to transfer data
💡 After step 3, the connection is established and handshake ends.
State Tracker
VariableStartAfter Step 1After Step 2After Step 3Final
Client StateClosedSYN sentWaiting ACKACK sentEstablished
Server StateClosedSYN receivedSYN-ACK sentWaiting ACKEstablished
Key Insights - 3 Insights
Why does the server send SYN-ACK instead of just ACK?
The server sends SYN-ACK to both acknowledge the client's SYN and to send its own SYN to the client, indicating it wants to establish a connection too. This is shown in step 2 of the execution_table.
What happens if the client never sends the final ACK?
The server stays waiting for the ACK and does not establish the connection. This is implied after step 2 in the execution_table where the client is expected to send ACK.
Is the connection established after the first SYN message?
No, the connection is only established after the client sends the final ACK (step 3). Before that, both sides are still in the process of setting up.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what message does the client send at step 3?
ASYN-ACK
BACK
CSYN
DFIN
💡 Hint
Check the 'Message Sent' column at step 3 in the execution_table.
At which step does the server send a message to the client?
AStep 1
BStep 3
CStep 2
DStep 4
💡 Hint
Look at the 'Sender' column in the execution_table to find when the server sends a message.
If the client never sends the ACK, what state does the server remain in after step 2?
AWaiting ACK
BClosed
CEstablished
DSYN sent
💡 Hint
Refer to the 'State After' column after step 2 in the variable_tracker.
Concept Snapshot
Three-way handshake:
1. Client sends SYN to request connection.
2. Server replies with SYN-ACK to acknowledge and request connection.
3. Client sends ACK to confirm.
Connection established after these three steps.
Ensures both sides are ready to communicate.
Full Transcript
The three-way handshake is a process used in computer networks to establish a reliable connection between a client and a server. It involves three steps: first, the client sends a SYN message to the server to request a connection. Second, the server responds with a SYN-ACK message to acknowledge the request and send its own connection request. Third, the client sends an ACK message to confirm the connection. After these three messages are exchanged, the connection is established and both sides can start communicating. This handshake ensures that both client and server are synchronized and ready to transfer data.