Socket Programming
Course Notes:
Supplementary Material:
- The 4.4 BSD Socket Intro Tutorial (as
postscript file)
- The 4.4 BSD Socket Advanced Tutorial
(as postscript file)
- C code for a simple client (client.c) and
server (server.c) that uses streaming sockets to send a message
from client to server. The code is from this
socket tutorial, which discusses the individual commands/steps.
- Compiling:
- The programs should compile "as is" on Linux:
- On Sun machines (running Solaris) you need to explicitly link
the socket and nls libraries:
- cc -o client client.c
-lsocket -lnsl
- cc -o server server.c
-lsocket
- Execution:
- The command-line interface for the server expects a port
number
the
server will be listening on (./server
<port>)
- The client expects a machine name and the
listening port (./client
<host> <port>).
- A simple intro to
sockets for Java
- A multithreaded Java Server
using sockets