a-
Before a client attempts to connect with a server, the server must first bind to and listen at a port to open it up for connections. A client may then establish a connection by initiating an active open using the three-way handshake:
SYN: The active open is performed by the client sending a SYN to the server. The client sets the segment's sequence number to a random value A.
SYN-ACK: In response, the server replies with a SYN-ACK. The acknowledgment number is set to one more than the received sequence number i.e. A+1, and the sequence number that the server chooses for the packet is another random number, B.
ACK: Finally, the client sends an ACK back to the server. The sequence number is set to the received acknowledgment value i.e. A+1, and the acknowledgment number is set to one more than the received sequence number i.e. B+1.
https://en.wikipedia.org/wiki/Transmission_Control_Protocol