Java Reference
In-Depth Information
Oneprocesswritesa
message
(sequenceofbytes)toasocket,whichbreaksthismes-
sageintoaseriesof
packets
(addressablemessagechunks,whicharecommonlyknown
as
IP datagrams
)andforwardsthesepacketstotheotherprocess'ssocket,whichrecom-
binesthemintotheoriginalmessageforthatprocess'sconsumption.
Figure9-1
shows
this scenario.
Figure 9-1.
Two processes use sockets to communicate.
networkmanagementsoftware,whichisoftenreferredtoasa
protocol stack
,breaksthis
messageintoaseriesofpackets(eachpacketincludesthedestinationhost'sIPaddress
and port number), and sends these packets through Host A's Network Interface Card
(NIC)tothedestinationhost,whichisHostBinthefigure.HostB'sprotocolstackre-
ceivespacketsthroughtheNICandreassemblesthemintotheoriginalmessage,which
itthenmakesavailabletoProcessB.ThissituationreverseswhenProcessBcommunic-
ates with Process A.
IP ADDRESSES AND PORT NUMBERS
IP addresses
are 32-bit or 128-bit unsigned integers that uniquely identify network
hostsandothernodes.A32-bitIPaddressiscommonlyspecifiedasfour8-bitinteger
componentsinperiod-separateddecimalnotation,whereeachcomponentisadecim-
alintegerrangingfrom0through255andisseparatedfromthenextcomponentvia
a period (e.g., 127.0.0.1). In contrast, a 128-bit IP address is commonly specified
as eight 16-bit integer components in colon-separated hexadecimal notation, where
each component is a hexadecimal integer ranging from 0 through FFFF and is sep-
arated from the next component via a colon (e.g., 1080:0:0:0:8:800:200C:417A). A
32-bit IP address is often referred to as an Internet Protocol Version 4 (IPv4) ad-