28.4 Ports and Sockets

   

Usually many network applications are running on one system simultaneously . These applications may be communicating to many other hosts using underlying TCP and UDP protocols. The question arises: how does the transport layer come to know that a received data packet corresponds to a particular application? To solve this problem, applications use a port number. A port number is a unique identification number assigned to an application. These port numbers are used while sending data to a particular application on another host. Port numbers for standard applications are listed in the /etc/services file on HP-UX. As an example, Telnet uses port number 23, and Web browsers use port number 80.

Many clients may be using one server application on a host at the same time with the help of the same port number. For example, many clients may be accessing the same Web server simultaneously. Since the port number used is the same, the server needs to have additional information to process client requests separately and send data to a client depending on a particular request. In our example of a Web server, different clients (Web browsers) are requesting different files, so the server needs to know to which client a particular file goes. This additional information is provided through the use of sockets. A socket is a combination of an IP address and port number. For example, when a client starts communication with a server, the server opens a socket on its side. For this socket, the client uses an available port number. If the IP address of the client is 192.168.3.l7 and the first available port number is 1035, the socket address will be 192.168.3.17.1035. Using this socket address, the client sends a request to the Web server having IP address 192.168.3.20, who is listening to incoming requests at port number 80 (HTTP port). The socket address of the server is 192.168.3.20.80. If the server accepts the request, a socket connection is established between sockets 192.168.3.17.1035 and 192.168.3.20.80 and data communication starts. Each client has a different socket address, so the server can communicate with each client separately.

A list of opened ports and connected sockets can be displayed using the netstat -a command on HP-UX. This list may be quite long depending on the network traffic on a host.


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net