0
votes

I understand that in the three-way handshake, sometimes the receiving end will send a SYNACK packet when establishing a connection (piggybacking), but when would it ever send a SYN and then an ACK packet?

For example:

->SYN

<-SYN_ACK

->ACK

versus:

->SYN

<-SYN

->SYN_ACK

Thanks!

1

1 Answers

5
votes

No it won't - here's the reason why

SYN is typically sent by the 'client' (eg. your browser) when it wants to open a TCP connection to a server (eg. your web server). A server has no way of 'knowing' beforehand which client wants to open a connection (and hence send a SYN) to it. So it cannot send an unsolicited SYN.

SYN and ACK are flags, so the SYN-ACK from server is an ACK to the client's SYN (and it's own SYN). Technically, it can send them separately, but, sending SYN and ACK separately would involve additional half round trip. 'cos then it would be a four way handshake ((c)SYN -> , <- SYN(s), <-ACK(s), (c)ACK ->) that doesn't achieve any more reliability than three way handshake offers. Consequently it makes no sense to do that way.

Having said so you could theoretically design a protocol with 4 way handshake, but TCP isn't designed so.

Hope that helps.