When the receiving end of a TCP connection sends its SYN/ACK packet(s?), are they sent separately? As in does the receiver send a packet with the control bit as SYN, with the receiving ends ISN, then a packet with the control bit set as ACK and its prediction of the senders next sequence number? Or can a packet contain both the SYN and ACK control bits with both the ISN and acknowledgement number?

1 Answer 1


Three-way handshake

1. step

The client begins the three-way handshake by sending a segment with the synchronize sequence number (SYN) control flag set, which indicates an initial value in the sequence number field. This value is known as the initial sequence number (ISN). The ISN is randomly chosen and is increased by one for each byte of data sent from the client to the server.
ACK : not set | SYN : set

2. step

The server must acknowledge the receipt of the SYN segment, so it sends a segment back with the ACK flag set. The client recognizes this as an acknowledgement that the server received the SYN from the client. The value of the ACK number field is the ISN + 1.
The server also must initiate a response to the client. To achieve that the server uses the SYN flag in the same way that the client did. (So it is one segment)
ACK : set | SYN : set

3. step

The client responds with a segment containing ACK that is the response to the SYN sent by the server. There is no user data in this segment. The ACK field contains one more than the ISN received from the server.
After both sessions are established between client and server, all segments exchanged will have the ACK flag set.
ACK : set | SYN : not set

(Note: the whole conversation between the client and the server is actually two one-way sessions)

Three-way handshake picture from Cisco ICND1 chapter

  • So the SYN flag and ACK flag are both set in the SYN/ACK packet from the server? Also, is the sequence number always incremented by one per segment? @Adam Hornyak
    – l30n1d45
    Commented Apr 6, 2015 at 19:19
  • SYN and ACK can be sent in the same packet, or two packets (rarely done any more) The SEQ increases when data is sent.
    – Ricky
    Commented Apr 6, 2015 at 23:25
  • @RickyBeam and when the SYN or FIN flags are set. That advances the sequence number by one, even though the packet itself may contain zero data.
    – Eddie
    Commented Apr 7, 2015 at 6:14
  • 1
    @l30n1d45 Not every segment increases the Sequence number. The sequence number is there to be a running byte count of all data that is sent, so naturally, every byte of data increases the sequence number by one. But there are many instances were a segment that contains zero data ought to be acknowledged by the other party, one of these cases is a SYN packet, if I send a SYN, its useful for you to acknowledge you received it, and you do so by increasing the "running byte count" by one byte, even though my original SYN didn't include any actual data. The FIN flag does the same thing.
    – Eddie
    Commented Apr 7, 2015 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.