TCP/IP Sockets Demo 1

Demo 1: Socket creation

This sample program illustrates the creation of a UDP 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-udp-01 directory. Then compile the file by running make or manually with:

gcc -o demo-udp-01 demo-udp-01.c

and run it:

./demo-udp-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:

gcc -o demo-udp-01 demo-udp-01.c -lsocket

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

Download the demo file (zip)