Network Socket Code Examples 
	Orion Sky Lawlor, olawlor@acm.org, 2006/01/22 (Public Domain)

These programs can be build on Linux or Mac OS X machines with:
	g++ -I. tinyclient.cpp -o tinyclient
	g++ -I. tinyserver.cpp -o tinyserver
	g++ -I. twoserver.cpp -o twoserver
	g++ -I. vulnserver.cpp -o vulnserver
	g++ -I. vulnclient.cpp -o vulnclient
	g++ -I. webclient.cpp -o webclient
	g++ -I. webserver.cpp -o webserver
Or use build.sh.  The -I. lets g++ find osl/socket.h.

And on Windows machines with (once you've got Visual Studio in your PATH):
	cl.exe /EHsc /I. tinyclient.cpp
	cl.exe /EHsc /I. tinyserver.cpp
	cl.exe /EHsc /I. twoserver.cpp
	cl.exe /EHsc /I. vulnclient.cpp
	cl.exe /EHsc /I. vulnserver.cpp
	cl.exe /EHsc /I. webclient.cpp
	cl.exe /EHsc /I. webserver.cpp
Or use build.bat.  The /EHsc turns on C++ exception handling.

See osl/socket.h for documentation on the socket routines used
here, or see osl/socket.cpp for the Berkeley sockets implementation.


You need to run the server before running the client.
I use two windows, and start the server in the left window,
then the client in the right window.  Windows XP SP2 will ask 
if you'd like to block the server from opening a server socket;
you'll of course have to unblock it to actually connect.

Try running the webserver example, and then point your web browser 
at http://localhost:1234.

All these servers and clients are hardcoded to use port 
1234.  Hopefully, you won't have any trouble using this port--
you can just do a global find and replace if you thing the port
is being used for something else on your machine.

