Java Reference
In-Depth Information
correspondence with the number of physical connections to the computer, of which
there may be only one (even though the number of ports used on that machine may
be much greater than this). Ports are implemented upon all computers attached to a
network, but it is only those machines that have server programs running on them
for which the network programmer will refer explicitly to port numbers. Each port
may be dedicated to a particular server/service (though the number of available
ports will normally greatly exceed the number that is actually used). Port numbers
in the range 1-1023 are normally set aside for the use of specifi ed standard services,
often referred to as 'well-known' services. For example, port 80 is normally used by
Web servers. Some of the more common well-known services are listed in Sect. 1.4 .
Application programs wishing to use ports for non-standard services should avoid
using port numbers 1-1023. (A range of 1024-65535 should be more than enough
for even the most prolifi c of network programmers!).
For each port supplying a service, there is a server program waiting for any
requests. All such programs run together in parallel on the host machine. When a
client attempts to make connection with a particular server program, it supplies
the port number of the associated service. The host machine examines the port
number and passes the client's transmission to the appropriate server program for
processing.
In most applications, of course, there are likely to be multiple clients wanting the
same service at the same time. A common example of this requirement is that of
multiple browsers (quite possibly thousands of them) wanting Web pages from the
same server. The server, of course, needs some way of distinguishing between clients
and keeping their dialogues separate from each other. This is achieved via the use of
sockets . As stated earlier, a socket is an abstract concept and not an element of com-
puter hardware. It is used to indicate one of the two end-points of a communication
link between two processes. When a client wishes to make connection to a server, it
will create a socket at its end of the communication link. Upon receiving the client's
initial request (on a particular port number), the server will create a new socket at its
end that will be dedicated to communication with that particular client. Just as one
hardware link to a server may be associated with many ports, so too may one port be
associated with many sockets. More will be said about sockets in Chap. 2 .
1.3
The Internet and IP Addresses
An internet (lower-case 'i') is a collection of computer networks that allows any
computer on any of the associated networks to communicate with any other com-
puter located on any of the other associated networks (or on the same network,
of course). The protocol used for such communication is called the Internet
Protocol (IP). The Internet (upper-case 'I') is the world's largest IP-based net-
work. Each computer on the Internet has a unique IP address, the current version
of which is still, for most people, IPv4 (Internet Protocol version 4), though this
is likely to change at some point during the next few years. This represents
Search WWH ::




Custom Search