TCP/IP Sockets Demo 1

Demo 1: Socket creation

This sample program illustrates the creation of a TCP/IP socket using the socket system call. It doesn't do anything except create the socket.

To run it, download the demo file and unzip it to create the demo-01 directory. Then compile the file by running make or manually with:

cc -o demo-01 demo-01.c

and run it:

./demo-01

The ./ prefix is there just in case you don't have the current directory in your search path (it's a good security practice not to). If you're on a SunOS (System V) machine, you'll need to link with the socket library by compiling with:

cc -o demo-01 demo-01.c -lsocket

You'll need to edit the makefile and uncomment the LIBS definition.

Download the demo file (zip)