Packet loss during TCP handshake

view full story

http://serverfault.com – I have to implement a pseudo TCP handshake that leads into a file transfer. I have no problem doing the file transfer: simple send-acknowledge. What I can't wrap my head around is how to do the three way handshake assuming there will be packet loss during one of the 3 steps. For instance: My client sends a SYN packet. If it times out (packet loss or just slow) waiting for SYN-ACK, it resends it. Server sends SYN-ACK. If it times out waiting for ACK, resend SYN-ACK. Now how does the client now that his ACK was received? (HowTos)