Before you start
IP sockets are the lowest-level layer upon which high level Internet protocols are built: everything from HTTP to SSL to POP3 to Kerberos to UDP-Time. To implement custom protocols, or to customize implementation of well-known protocols, a programmer needs a working knowledge of the basic socket infrastructure. While this tutorial focuses primarily on C programming, and also uses Python as a representative higher-level language for examples, a similar API is available in many languages.
This tutorial introduces you to the basics of programming custom network tools using the cross-platform Berkeley Sockets Interface. Almost all network tools in Linux and other UNIX-based operating systems rely on this interface.
This tutorial requires a minimal level of knowledge of C, and ideally of Python also (mostly for the follow-on Part 2). However, if you are not familiar with either programming language, you should be able to make it through with a bit of extra effort; most of the underlying concepts will apply equally to other programming languages, and calls will be quite similar in most high-level scripting languages like Ruby, Perl, TCL, and so on.
Although this tutorial introduces the basic concepts behind IP (Internet Protocol) networks, some prior acquaintance with the concept of network protocols and layers will be helpful (see Resources at the end of this tutorial for background documents).