1. Short answer is no, there is nothing like fork()
in the Win32 API, but it should be possible to implement it since CygWin provide a fully featured fork() on Windows. But you don't seem to actually need fork()
for your application.
2. Actually your options are :
- Create at least one thread/process for each client/connexion
- Create only one thread/process for all client/connexion (using an event-driven approach as instance)
- Mix the two above
The best approach depends on your application but for handling a maximum of only 40 simultaneous client, you can very well have one thread per client.
You could use the POSIX standard thread library pthread
to create and manipulate threads. This` library is standard in all POSIX-conformant OS (GNU/Linux, Mac OS X, BSD, etc.) and has been ported to Windows. So this approach would allow you to have a very nice portability.
Although if you want to use the Win32 API, you should take a look at CreateThread.