TCP is a connection-oriented transport protocol, so it must establish a reliable session before user data can be exchanged. To create the session, TCP uses the three-way handshake: the initiator sends a SYN to request a connection and advertise its initial sequence number, the responder replies with SYN/ACK to acknowledge the request and provide its own initial sequence number, and finally the initiator sends an ACK to confirm receipt. This process confirms bidirectional reachability, synchronizes sequence numbers, and prepares both ends for reliable delivery, retransmission control, and flow control.
To end a TCP connection gracefully, TCP performs an orderly close in both directions (full-duplex). One endpoint sends FIN to indicate it has no more data to send, the peer responds with ACK . When the peer is also ready to stop sending, it transmits its own FIN , and the original endpoint responds with a final ACK . Because each direction is closed independently, termination is typically described as a four-way handshake .
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit