The title expresses the way TCP establish a connection.
When TCP establish a connection it must do that scenario :-
- your server should be prepared to accept a connection.
- the client issues something called active open (Enables Socket – Allocate socket – initiate the connection). this causes the connection to send a synchronize segment (SYN) to tell the server client’s initial sequence for the data that will be sent. a SYN has only the TCP header and IP header.
- server must Acknowledge (ACK) the client’s SYN and the server must send it’s own SYN. with the data sequence that the server will send. so an ACK and SYN are sent in the same time.
- the client acknowledge the server’s SYN.
in normal cases only three packets are exchanged to establish a connection, so this is like 2 people shaking hands before getting known to each others ( three-way handshakes).
Connection Termination follows the same handshaking thing but 4 instead but we don’t call it the 4 way handshake. the termination goes as follows :-
- An application of the two requests to close the connection, so he performs an active close. so the guy who wants to close the connection says it’s finished sending data by sending a FIN segment.
- when the other guy receives that FIN. it acknowledges the received FIN, and passes the application an end-of-file (EOF). which is called a passive close
- later the other guy who just received that FIN will close it’s connection too. so it will send FIN.
- and the guy who receives that FIN perform the active close. connection is now history