Legal Stuff: Several of the examples here are in the public domain, and the rest are free to use and copy. Use them, learn from them, enjoy them. But please understand that there is NO WARRANTY OF ANY KIND attached to these examples.

I’ve tested all of these examples with the command line compilers from Borland C++ 5.0 and Visual C++ 5.0. All of these examples can, in principle, be made to work with older compiler versions, but since I like to make use of newer C++ features, you may have to change some of the code to get the examples to compile. I’ve heard reports that some of the newer compilers may complain about some of this code as they obey the letter of the Standard more and more closely. I don’t have time right now to rework these examples to follow changing compiler behavior, so be prepared to tweak the code a bit, as needed.

Most of the programs are Win32 console programs written in the "better C" subset of C++. This keeps the programs simple, letting you concentrate on the networking code. The exceptions are the samples that use asynchronous sockets, since this requires the use of a Windows message queue; they use C++ and MFC in order to minimize the amount of GUI code.

Most of these examples use the Winsock 1.1 API. Only those programs that actually use Winsock 2 features require the Winsock 2 API. For compatibility reasons, I recommend that you follow this practice in your own programs.

The header comment for each example shows how to compile that example.

The Examples

<< MS Knowledge Base Articles
Basic Example Programs >>
Updated Sun Jan 18 2015 04:24 MST   Go to my home page