Java Reference
In-Depth Information
another program, it must tell the network where to find the other program. In TCP/IP, it takes
two pieces of information to identify a particular program: an Internet address , used by IP, and
a port number , the additional address interpreted by the transport protocol (TCP or UDP).
Internet addresses are 32-bit binary numbers. 1 In writing down Internet addresses for
human consumption (as opposed to using them inside applications), we typically show them
as a string of four decimal numbers separated by periods (e.g., 10.1.2.3); this is called the
dotted-quad notation. The four numbers in a dotted-quad string represent the contents of the
four bytes of the Internet address—thus, each is a number between 0 and 255.
One special IP address worth knowing is the loopback address , 127.0.0.1. This address
is always assigned to a special loopback interface , which simply echoes transmitted packets
right back to the sender. The loopback interface is very useful for testing; it can be used even
when a computer is not connected to the network.
Technically, each Internet address refers to the connection between a host and an
underlying communication channel, such as a dial-up modem or Ethernet card. Because each
such network connection belongs to a single host, an Internet address identifies a host as
well as its connection to the network. However, because a host can have multiple physical
connections to the network, one host can have multiple Internet addresses.
The port number in TCP or UDP is always interpreted relative to an Internet address.
Returning to our earlier analogies, a port number corresponds to a room number at a given
street address, say, that of a large building. The postal service uses the street address to get the
letter to a mailbox; whoever empties the mailbox is then responsible for getting the letter to the
proper room within the building. Or consider a company with an internal telephone system:
to speak to an individual in the company, you first dial the company's main phone number to
connect to the internal telephone system and then dial the extension of the particular telephone
of the individual that you wish to speak with. In these analogies, the Internet address is the
street address or the company's main number, whereas the port corresponds to the room
number or telephone extension. Port numbers are 16-bit unsigned binary numbers, so each
one is in the range 1 to 65,535 (0 is reserved).
1.3
About Names
Most likely you are accustomed to referring to hosts by name (e.g., host.example.com). How-
ever, the Internet protocols deal with numerical addresses, not names. You should understand
that the use of names instead of addresses is a convenience feature that is independent of
the basic service provided by TCP/IP—you can write and use TCP/IP applications without ever
1 Throughout this topic the term Internet address refers to the addresses used with the current version of
IP, which is version 4 [12]. Because it is expected that a 32-bit address space will be inadequate for future
needs, a new version of IP has been defined [5]; it provides the same service but has much bigger Internet
addresses (128 bits). IPv6, as the new version is known, has not been widely deployed; the sockets API will
require some changes to deal with its much larger addresses [6].
 
Search WWH ::




Custom Search