This page contains the course code for Computer
Networks. This includes source code examples handed-out in class.
Demonstration of basic TCP/IP client/server model:
The programs tcpServer.c
and
tcpClient.c implement a simple TCP client/server model using sockets.
A text message is transferred from server to client and then from client to
server. Programs conditionally compile for Winsock or BSD sockets.
Demonstration of basic UDP/IP client/server model:
The programs udpServer.c
and
udpClient.c implement a UDP client/server model similar to the above
TCP model. Programs conditionally compile for Winsock or BSD sockets.
Demonstration of other sockets functions:
A program to get the IP address of a host is
getaddr.c.
A program to get the host name for an IP address is
getname.c.
A program to demonstrate htonl() is
htonl.c.
Demonstration of threads:
A demonstration of Windows threads and pthreads (POSIX threads) is
thread.c.
The "world's smallest Web server" program:
A very simple Web server implementation is
weblite.c
(Windows and Unix). A screenshot showing a sample execution is
here (note that a file named
test.html with the shown contents must exist in the same directory
from which weblite is executed).