Time for another question from my Ask InetDaemon mailbox:

Thanks for the excellent article on TCP, this was the best ever explanation
I've found. Could you please provide me with the C++ implementation code for
TCP handshake protocol?

The handshaking is a function of the TCP protocol, and not really a protocol unto itself.  Thus, handshaking is not a standalone piece of code.  It’s integrated in the actual TCP software, first implemented in Berkeley BSD UNIX.

If you want a copy of the source code, you should learn to use a CVS client to download (sync) a copy of the BSD source in the CVS repository, provided you’re using a BSD compatible computer and operating system. The Berkeley Sockets implementation is the de-facto standard for TCP.

Synchronizing Your Source.