Winsock Programmer's FAQ
This client is the simplest possible client, if you count error-checking and reporting, proper connection shutdown, helpful comments and name lookup as essential. You can strip all that out and have a much shorter program, though I can't imagine why you'd want such a thing.
Like all the examples, the real work starts out in
The example then does a DNS lookup on the remote peer's address,
if necessary. Notice that in
The example then executes the same echo sequence that all the clients in this series implement. All this comes to just over 150 lines of code. That might seem like a lot for such a basic program, but as you'll see, the blocking nature of this program makes it very simple compared to the other client programs.
The only module you will need to compile this program, aside from the common files listed on the main examples page, is basic-client.cpp. The comment at the top of the file gives complete compilation instructions; alternately, you can use the common Makefile.
|<< Basic Example Programs||Asynchronous I/O Client >>|
|Last modified on 19 October 2001 at 15:16 UTC-7||Please send corrections to firstname.lastname@example.org.|
|< Go to the main FAQ page||<< Go to the Home Page|