Ports and Sockets

21 Apr

Ports and Sockets
The means by which these client/server computers communicate over the network is through sockets, and the language they speak are protocols (more on those in the next section).

Figure 2-9: Client/server

A socket is a logical connection for computer applications to pass information back and forth between networked computers. In a similar fashion, a serial port is a physical connection for passing information between a computer and a peripheral device. A socket is one endpoint of a two-way communication link between two programs running on the network. Two-way communication over the Internet is typically performed by client-server pairs. A server creates a socket that can listen for connection requests from clients. When a client creates a socket, a connection request is made. The mechanism that associates a specific client socket to a specific server socket is a port. A port is a 16-bit number typically associated with a particular application layer service such as web browsing (the HTTP protocol), Telnet, or FTP. Client/server communication proceeds as follows. A server creates a special server socket that is associated with, or binds, to a specific port number. It then listens for client requests for connections to that port. When a client wants to communicate with the service offered the server, it creates a socket to that port. The server accepts the connection and responds with information. Port numbers 1-1023 are reserved and correspond to pre-defined services such as email, web pages, Telnet, FTP, ping, finger, time, etc. Table 2-3 lists port numbers and services for some well-known ports. Use these port numbers with caution! Unless you are trying to write programs to communicate with these predefined services, choose a port number 1024 or higher.

Table 2-3: Some common ports

A very detailed  (and long) list of port assignments can be found on the  “Assigned Port Numbers”2 page and also in RFC1700. Port numbers 1024 -65,535 are available for use in your own programs to form custom services.

So now you have a nice quick overview of networks. This really was not intended to be a complete lesson in building computer networks; in fact, we have just barely scraped the surface. Hopefully, however, you now have enough information to successfully complete the projects in the rest of this book and the background to understand them. We would encourage you to examine some of the references listed next if you need more information or are just curious.

1.  Charles Spurgeon’s Ethernet Web Site.


2.Configuring the DNS Service.


3.TechFest Ethernet Technical Summary.


4.Bennett, Geoff.
Designing TCP/IP Networks. Van Nostrand Reinhold, 1995

5.Semeria, Chuck.
Understanding IP Addresses: Everything You Ever Wanted To Know.
3Com Corporation, April 26, 1996.


6.A Request for Comments (RFC) is a document written by the Internet Engineering Task Force. These are the result of a committee drafting and subsequently reviewed by interested parties. Some become Internet stan-dards, however, through subsequent RFCs that supercede an existing RFC. You can view the RFCs online in a number of places; one of the more complete is “Internet RFC/STD/FYI/BCP Archives,”


These are some common RFCs that you might want to know about if you are working on a project that uses a specific protocol for communication:

• 791 = IP
• 1700 = Assigned numbers
• 1920 = Telnet
• 959 = FTP
• 977 = NNTP

Random Posts

Comments are closed.