C/C++ Client Server Socket Examples

When talking about C/C++ client server examples, there are primarily three ways of handling multiple simultaeneous connections. You can spawn a new process using fork, creat a new thread using the POSIX thread library (or some other library) or you can use Overlapped IO. Our examples will cover all three options. These working examples are simple to understand, build and test.

Linux C++ Forking Server and Client Socket Example

Linux C++ Socket Example with Client Server and Mulit-Threading

Linux C++ Overlapped Server and Client Socket Example

Of course you can always use a combination of these methods for some truly awesome servers. But once you know the basics of threading, forking and overlapped io, you can be server programming guru.

Also we stronly suggest that you attempt the pthread model first, then the forked model and finally the overlapped model. All three examples share the client code.

You can download the all the 3 zipped example here.