/The next three handshakes

The next three handshakes

The title expresses the way TCP establish a connection.

When TCP establish a connection it must do that scenario :-

  1. your server should be prepared to accept a connection.
  2. 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.
  3. 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.
  4. 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 :-

  1. 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.
  2. 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
  3. later the other guy who just received that FIN will close it’s connection too. so it will send FIN.
  4. and the guy who receives that FIN perform the active close. connection is now history

By the way the title’s idea is from (The next three days)  for Russell crowe.