|
|
Winsock Programmer's FAQ |
|
|
The threaded server is probably the simplest "real" server type to understand. A server program almost always needs to handle more than one connection at a time, and this is the simplest way to do that under Winsock. The reason is, since each connection gets its own thread, each thread can use simple blocking I/O on the socket. All other multi-connection server types use non-synchronous I/O of varying complexities in order to avoid thread overhead. This server isn't that different from the basic single-connection server. The architectures are fairly different, but some of the code is identical between the two server programs. In the basic server, the Each thread handles its connection more or less identically
to the way the basic server handles each connection. In fact, the
Building the ProgramThe only module you will need to compile this program, aside from the common files listed on the main examples page, is threaded-server.cpp. The comment at the top of the file gives complete compilation instructions; alternately, you can use the common Makefile. |
|
<< Basic Blocking Server |
select()-based Server >> |
| Updated Sat Jun 11 2005 00:32 MDT | Go to my home page |