View Single Post
Old January 9, 2011   #19
dice
Tomatovillian™
 
Join Date: Jan 2007
Location: PNW
Posts: 4,743
Default

A little more on internet protocols and "port numbers":

So what are these "port numbers"? They basically work
like post office box numbers.

You can think of a network server as a kind of post office.
It starts up server processes that "listen" for connections.
Often there will be more than one listener. It may have
a WWW server, an email (smtp) server, a Domain Name System
(dns) server, a Secure Shell (ssh) login server, a Kerberos
server (different kind of secure login system), a File
Transfer Protocol (ftp) server, a Network Time Protocol (ntp)
server, and so on. When it receives a request from a remote
client at another machine, like a web browser, how does it know
which listening process the remote user's client wants to
connect to?

That is what port numbers are for. When the WWW server
process starts up, it typically tells the network server's operating
system that it wants to listen on tcp ports 80 and/or 8080. When
the email server starts, it tells the operating system that it wants
to listen on tcp port 25. The DNS server listens on udp and/or tcp
port 53. And so on for the other listening processes. Well-known
and registered services have officially assigned port numbers
from IANA ( http://www.iana.org/assignments/port-numbers ),
but the listening processes can ask the operating system to
listen on any port that they specify (if two different server
processes running on the same network server want to listen
for connections to the same port at the same time, that does
not work).

You see this all of the time with online streaming audio. You
connect to a WWW server serving streaming audio on tcp port
80 or 8080, and the server redirects your web browser to
connect to some other arbitrary port number to receive
the audio packet stream. It is using port numbers to seperate
different audio streams that it is serving to different remote
network clients at the same time (there are other ways
to do this, seperating different client sessions internally that
are all connecting to port 80, but forcing them to connect
to different ports for different audio streams seems to be
common practice).

The remote client processes, the web browsers, email clients,
etc, have their own port numbers, too, but those are usually
assigned dynamically by the client's operating system when
the client process requests a connection to a remote server.
The client's operating system just picks a port number for that
particular session at random from the high port number range,
recycling those port numbers as short-lived client sessions end.
__________________
--
alias

Last edited by dice; January 27, 2011 at 09:10 AM. Reason: minor detail
dice is offline   Reply With Quote