Beej’s Guide to Network Programming
A relatively concise and complete introduction to sockets programming.
The guide covers:
1) the data structures for representing internet addresses.
2) the functions for making sure bytes are in the correct representation
3) the two types of internet sockets (SOCK_STREAM and SOCK_DGRAM)
4) the sockets API including the order of function calls for the different situations (client vs server, stream vs datagram). Also covers connected datagrams (a matter of convenience).
5) the basics of creating client server applications
6) how to use select() to do non-blocking I/O on sockets
7) how to handle partial reads/writes
8) having client and server agree on message formats