Unix Network Programming Manual
Introduction
Programming for a network environment is essentially
communication between processes
residing on different machines. This is not really any different than
communicating between processes on the same machine, but this is not
something that people commonly do either.
If you think about what is involved in communicating between processes,
there are a few things that are obvious. One is that there
must be some way to synchronize the processes. For example, if you want
to logon to a remote machine, there must be some way to indicate to the
other machine that you want to perform this operation. Similarly, if you
want to send a file to another machine, it must have a process running that
is ready to accept the data and put it into a file.
One model of synchronization that is widely used is called the client{--}server
model. In this model, there must be one process, called the server, that
is running and waiting for communications. The client must know enough to
reach that server and tell it what service it desires. At this point, the
two are synchronized, and as long as each observes the protocol rules,
they can continue to exchange messages.
Another issue is that of addressing. How does a process send a message to
a specific process executing on the same or another machine.
There are
a number of schemes for doing this, and addressing is a major distinction
between protocol families.
Finally, how is all of this communication supported by the operating system.
It would not be very effective to have each user writing drivers for
network interface devices and haphazardly sending and receiving data. This
would be similar to allowing users to write a line to a printer anytime
they felt like it. You would need a paper cutter and tape to put
your output together. We will be looking at the Unix interface to
networking, which is widely used and copied by other systems. However,
if you use VMS or some other operating system, things will be different,
even if you are using the same network and protocols. Fortuitously,
Microsoft copied Unix heavily in developing their version of the network
programming interface, commonly called WinSock.
The other sections of this manual describe various parts of the network
programming process. The programs have been tested on several platforms,
but it may be necessary to modify paths to include files or to make minor
modifications in some calls due to differences in implementations of
data structures. These changes should be minor.