<< |
Winsock Programmer's FAQ |
>> |
This program is the direct counterpart of the basic client example: it is the simplest possible program of its kind. This program simply sets up a listener on the network interface and port passed on the program's command line, accepts incoming connections, and echoes the remote peer's packets back to them. The skeleton The program then enters an endless loop to wait for connections. It accepts each incoming connection and then bounces packets back to the client until the client closes the connection. When that happens, the server closes its side of the socket and then goes back to waiting for connections. Notice that you must pass an address on the command line to
this program, due to the way the common Interesting BehaviorThis server exhibits some interesting behavior that you may want to experiment with.
Building the ProgramThe only module you will need to compile this program, aside from the common files listed on the main examples page, is basic-server.cpp. The comment at the top of the file gives complete compilation instructions; alternately, you can use the common Makefile. |
<< CAsyncSocket-based Client | Multithreaded Server >> |
Last modified on 3 July 2000 at 18:32 UTC-7 | Please send corrections to tangent@cyberport.com. |
< Go to the main FAQ page |
|
<<< Go to my Home Page |