If 2 host Simultaneously try to establish connection:
Simultaneous Open:
* It's possible for two applications to send a SYN to each other to start a TCP connection, although the possibility is small, because both sides have to know which port on the other side to send to.
This process is called "Simultaneous Open", or "simultaneous active open on both sides".
* In a simultaneous open, both applications issue active opens.
* This is a rare situation in which there is no client or server; communication is between two peers that know their local port numbers.
* Both TCPs go through SYN-SENT and SYN-RCVD states before going to the ESTABLISHED state.
* Both processes act as client and server.
* The two SYN+ACK segments acknowledge the SYN segments and open the connection.
OR
Simultaneous Close:
* It's permitted in TCP for both sides to do "active close", which is called "Simultaneous Close". During "Simultaneous Close", 4 packets are exchanged, the same as in normal situations.
* In this situation, both ends issue an active close.
* Both TCPs go to the FIN-WAIT-1 state and send FIN segments that are in transit simultaneously.
* After receiving the FIN segment, each end goes to the CLOSING state and sends an ACK segment.
* The CLOSING state takes the place of FIN-WAIT-2 or CLOSEWAIT in a common scenario.