The previous sections of the Developer's Guide described what
information a program needs to communicate over a TCP/IP network.
The next step is for the program to create what is called a socket,
a communications end-point that can be likened to a telephone.
However, creating a socket by itself doesn’t let you exchange
information, just like having a telephone in your house doesn’t
mean that you can talk to someone by simply taking it off the hook.
You need to establish a connection with the other program, just as
you need to dial a telephone number, and to do this you need the
socket address of the application that you want to connect to. This
address consists of three key parts: the protocol family, Internet
Protocol (IP) address and the service port number.
We’ve already discussed IP addresses and service ports, but what’s
the protocol family? It’s a number which is used to logically
designate the group that a given protocol belongs to. Since the
socket interface is general enough to be used with several
different protocols, the protocol family tells the underlying
network software which protocol is being used by the socket. In our
case, the Internet Protocol family will always be used when
creating sockets. With the protocol family, IP address of the
system and the service port number for the program that you want to
exchange data with, you’re ready to establish a connection.