Alan Dix's short courses and tutorials

UNIX Network Programming with TCP/IP

Client-Server and Internet Applications

Alan Dix
(first delivered while at School of Computing, Huddersfield University)

I haven't run this particular course for a number of years, but see below for free online materials and alternative courses.

Online materials:
        You can download the complete notes (PDF) for this course
... and you can browse and download the sample code used in the exercises
These notes and code are free to use, but if you use them do acknowledge them and give this URL.
errata: The code examples were prepared on a big-endian processor, so some of the port numbers may get reversed if you are working on a little-endian machine (e.g. Intel). If this is the same at both client and server ends the code will still work, but may be confusing. Use htons to make this right. Many thanks to zhzh cao for pointng this out
I also have online notes for tutorials on UNIX System Programming and UNIX Power Tools.
If you are interested in more human issues around networking applications and internet usability see my chapter on Network-Based Interation in Jacko and Seers' HCI Handbook, my chapter on HCI and Web Design in the Handbook of Human Factors in Web Design, not to mention relevant chapters of my co-authored textbook on Human-Computer Interaction!
Other tutorials and useful links ...
     Look at the IBM TCP/IP Tutorial. This is one of their free Redbook series.
The classics in this area are still the books by Richard Stevens
In particular the home page for the book Unix Network Programming includes a full source code for all examples.
Beej's Guide to Network Programming adopts a somewhat zany style (too much late night pizza and cola), but deals comprehensively with the UNIX system calls and socket level programming. It is mirrired in several places and has been translated into vations languages from Chinese to Belorusssian.

The fundamental principles of TCP/IP programming are independent of platform. This tutorial uses C as its language, and to see how to do similar things in other languages try:
Java: Socket Communications in Java at Oracle
Perl: Network Programming with Perl at Linux Journal
PHP: Socket Programming with PHP at Dev Shed

Tutors: Alan Dix
Audience: UNIX systems programmers and software developers. May be especially attractive to experienced PC developers wanting to produce UNIX servers.
Style: Combination of short lectures and hands-on sessions.
Content: The importance of platform independent networks. Understanding the Internet: what it is, addresses, names and routers, levels of protocols (IP, UDP and TCP). How TCP works: port numbers, active and passive opening, establishing connections. The UNIX socket system calls (socket, bind, listen, connect etc.). Writing a client. Using select to manage multiple I/O streams. Alternative call-back based solutions. Writing a server. Use of fork to service client connections. Mixing bespoke client­server applications with shared databases or shared files.
Objective: The attendee should leave the course able to write clients to access existing services such as ftp and www, and be able to begin to write their own client server software under UNIX.
Prerequisites: Basic knowledge of C programming under UNIX, including a good understanding of low-level UNIX I/O. Fork and select will be introduced rapidly, so some familiarity with these would be an advantage.
Length: 2/3 days depending on selction of topics
Note: The main language used will be C under UNIX, but comparisons will be made with Java TCP/IP as appropriate.
Client­server software will often be written with UNIX servers and PC based clients. Versions of this course with different client-end focus (Java, Windows, Mac) can be delivered by special arrangement.


http://www.hiraeth.com/alan/tutorials/tcpip/tcpip.html Alan Dix 5/8/98
(updated 23/10/04, 5/1/2006)