next up previous contents
Next: The Socket Library Up: TCP/IP Networks Previous: The User Datagram Protocol

More on Ports

       

Ports may be viewed as attachment points for network connections. If an application wants to offer a certain service, it attaches itself to a port and waits for clients (this is also called listening on the port). A client that wants to use this service allocates a port on its local host, and connects to the server's port on the remote host.

    An important property of ports is that once a connection has been established between the client and the server, another copy of the server may attach to the server port and listen for more clients. This permits, for instance, several concurrent remote logins to the same host, all using the same port 513. TCP is able to tell these connections from each other, because they all come from different ports or hosts. For example, if you twice log into quark from erdos, then the first rlogin client will use the local port 1023, and the second one will use port 1022. Both however, will connect to the same port 513 on quark.

    This example shows the use of ports as rendezvous points, where a client contacts a specific port to obtain a specific service. In order for a client to know the proper port number, an agreement has to be reached between the administrators of both systems on the assignment of these numbers. For services that are widely used, such as rlogin, these numbers have to be administered centrally. This is done by the IETF (or Internet Engineering Task Force), which regularly releases an RFC titled Assigned Numbers. It describes, among other things, the port numbers assigned to well-known services. uses a file mapping service names to numbers, called /etc/services. It is described in section gif.

It is worth noting that although both TCP and UDP connections rely on ports, these numbers do not conflict. This means that TCP port 513, for example, is different from UDP port 513. In fact, these ports serve as access points for two different services, namely rlogin (TCP) and rwho (UDP).

 


next up previous contents
Next: The Socket Library Up: TCP/IP Networks Previous: The User Datagram Protocol

Andrew Anderson
Thu Mar 7 23:22:06 EST 1996