Using Port Numbers and Protocols
Simply knowing how to send a message to a computer is not sufficient. Most computers need to access various services across the Internet, and some computers provide those services. There needs to be a way to separate the incoming traffic and direct the information to the appropriate program. This is done through the use of ports.
A port is simply another address that is local to the computer. Various functions access various ports. For instance, a web server will listen on port 80 for requests and will respond with the requested information. An FTP server listens on port 21. Port numbers can range from 0 to 65,535 (or 216 –1).
Over the years, Internet users have agreed on a list of well-known port addresses. These addresses reflect the port numbers that people should try to use when they want to access a particular type of server. Some well-known port numbers for some of the most common Internet services are listed in Table 11.1.
NOTE: Many port numbers are well known: A lot of port numbers belong on this list (for instance, Doom uses port 666 for multi-user game play). I omitted some numbers from the table because they aren’t very common. For a more complete list, look at the file C:\Windows\Services.
Table 11.1: Some Well-Known Port Numbers
|Daytime||13||Daytime protocol—returns date and time information|
|ftp-data||20||FTP (File Transfer Protocol), default data port—transfers files between systems|
|ftp||21||FTP, control port|
|Telnet||23||Telnet—provides terminal access to a remote computer|
|Smtp||25||SMTP (Simple Mail Transport Protocol)—transfers mail between systems|
|Time||37||Time protocol—returns date and time information|
|Domain||53||DNS (Domain Name Server)—converts a domain name into an IP address|
|Finger||79||Finger protocol—returns information about a remote computer or user|
|www-http||80||WWW (World Wide Web), HTTP (HyperText Transport Protocol)—retrieves HTML-formatted documents|
|Pop3||110||POP3 (Post Office Protocol) version 3 protocol—retrieves e-mail messages|
|nntp||119||NNTP (Network News Transport Protocol)—retrieves news articles|
When looking at Table 11.1, you may notice that many of the port numbers are also associated with a protocol. Protocols are a way for one computer to request information from another and understand its response. For the most part, protocols are well-documented command strings and ranges of valid responses. The Internet Transfer control supports two protocols: the File Transfer Protocol and the HyperText Transfer Protocol, which I’ll cover soon. But first I want to finish up here with one last item you need for Internet applications: a Universal Resource Locator.