You are on page 1of 205

TCP/IP



.
-1 : ) OSI (
-2 ) TCP/IP ( .


. OSI .

. TCP/IP .
Addressing-3 TCP/IPProtocolSwitch-2 OSIModel-1 :

-4 . TCP/IP
OSI Model OSI Model : ISO .

OSI .
:
-1Physical
-2DataLink
-3Network
-4 Transport
-5Session
-6Presentation
-7 Application

Host Host Host


Node Router

. :

IntermediateNode. Physical
DataLinkNetwork .HostRouter
RouterHost
.Interface
NetworkDataLink .

ISO
Header Data .
Header Header Trailer .
Trailer .

Host Host
Data L7
Header . H6 Data
Header H5
Trailer Header . Data
.

Header Header
. Data Data link

L2
Data Data link .

:Physical layer
Physical Physical Host
Router Router

Host Host .
Data
.
Coaxial Twisted pair
. Data Physical

. Protocol Physical

Physical Data Rate Synchronization Signal Modulation

Data .
Data .
Data Physical .
Modulation Modulation
Data .
.
.

Datalink OSI
: DataDatalinklayer .
Network Data L3 Network Datalink

Datalink Physical

Physical Data .

Datalinklayer Data
. Datalink :

Framing Header Trailer ) H2 ( T2


. Addressing .

Flowcontrol Node Data . Node Node

Node Data Data


.

Flow Node Datalink

Errorcontrol Data

Datalink Data Node Node . Data

Data . Datalink Error

control . .

Accesscontrol Accesscontrol .

Node Data

Data

Data . Access

control Node
Data Node Node .

DatalinkPhysicallayer

Host . A Host B Host

F.E
Data A D A F F . D
Node Bridge
Router Link .
Inter mediate node
.
Data A F . A B A . B
Link A B Physical Data
DataLink A DataLink B
Data A B . B A

Data Data A . B E

Data link Communicate Data


B E .
hopto hop delivery . Data link Node
B E .

Network OSI
:Network
Net work IP Internet protocol TCP\IP

. Network Data Host Host


.
.
Routing Data Host
Host . Addressing
. Router Host
TCP\IP IP Data
.
Data Network Transportlayer Header
Header Data
controlerror . . Data Net
work Data link Data link Physical

Physical

Physical Physical Data link


Datalink Network Network . Transport
Net work Router Data
.

Network Network
A Host B Network Data
Link E
Data E . Node Net work
Node Router .
hop to hop delivery Router Router
Host . Endtodelivery A B A Delivery F
Net work . Net work Data
End system Host Host .
Endtodelivery .

Transport OSI
Trans port TCP TCP\PI .
Data
. flow Error Trans port
Error Flow
Node Router Host Router .
Trans port Data
. Flow control Error

control .

Host
Networklayerhosttohost

delivery IP Net work


Data Endtoendreliable

delivery Data
Flow Data Error .
.

.

Session layer
Session

layer TCP\IP Application


Synchronization .
.

syn .
Data
syn
. Data
syn .

Presentation OSI

Presentation Data Application layer


Data Presentation .
Presentation Data
. Data Data
Data Cooperation Compress . Data

Compress .
Application
.

Filetransfer Email Application Data

Presentation Presentation Session Session

Transport Transport Network - Network Datalink - Datalink Physical


.

.
: TCP\IP
TCP\IP
TCP\IP .
TCP\IP .

TCP\IP . Physical Data link


.
Underlyingnetwork DatalinkPhysical Network IP Internet

Protocol Trams port TCP UDP Transport


TCP\IP .

TCP UDP Session PresentationApplication


. Application TCP\IP
.
Physical
. Physical Mac Address Data
PhysicalAddress .
IP Address :IP Host Router IP Address
.
: Port Address Physical Address IP

Address . Port Address


.

PhysicalUnderlyingNetwork


Physical Datalink .
IP OtherProtocol Network IPAddress IPAddress

Transport TCP PortAddress UDP .


Physical Underline

PhysicalNetwork .
IP Network IPAddress PortAddress UDP - TCO .

Physicaladdresses

48 .
unique
. .

IPAddress

Header Network Header


IP
. IPAddress . IP 32
:
132.24.75.9

PortAddress

A Host Data P Host Data Application


Transport Transport Physical-1 :
Transport Address -3 Network Address-2 . Network
A P Data link Header

PortAddress . P1 .

UnderlyingTechnologies
:
.1 LAN
.2 WAN


. LAN Point to Point WAN
.

WAN Switch

WAN .
): LAN(LocalAreaNetwork
LAN Ethernet CSMA/CD
.
CSMA BUS
BUS BUS .

CSMS/CD Minimumframelength
Transmission rate Collision

Domain . PropagationSpeed
10BASE2 200 .
100Mbps 1000Mbps .
CSMA/CD .

CSMA/CD OSI

OSI Data link layer Physical

layer . Ethernet Data link


Logicallinkcontrol Mediaaccesscontrol Physical .
MAC
LLC . Flow Control .

Ethernetframe

Ethernet .
.
: Preamble Start frame delimiter
Ethernet .
: Startframedelimiter 1 0101011 Preamble .
: Destination address & Source address
MAC .
: LengthPDU
: Data and padding Logical control

.
: CRC

10BASE5

10BASE5 .
: 10BASE5
10Mbps .1
.2 Baseband
.3 500 Repeater .
.4 Repeater 2/5 .
: 10BASE5
.1 Coaxial
.2 ExternalTransceiver

.3

10BASE5

10BASE2 .
:10BASE2
10Mbps .1
.2 Baseband
.3 200 Repeater .
.4 Transceiver BNC
.
.5 Repeater .
:10BASE2
.1 Bus
.2

10BASE5

10BASET .

Twistedpair .

10BASEFL

10BASEFL .

Hub .
10BASE5 External Transceiver Connector
. 10Mbps .

100BASETX .
100Mbps TwistedPair .
200 100 .

100BASEFX .
100Mbps .

FastEthernetimplementation 100BASET4 .
Twisted Pair
.
Connector External transceiver

1000BASESX/LX .
Repeater Hub .

1000BASET .
1000BASE TwistedPair .

TokenRing

Token . )
( Token
Token .

Token A C
. B . D
D C C A
A . Token B B
.

Token .

MAU .
MAU MAU
.

Connectingdevices


100 200 . Device
.

:Repeater .
Segment Repeater LAN
Filtering .

Level
Hub . Hub Level
.

Bridge

Bridge .
Bridge -1 : -2Datalink

Bridge TransparentBridge Bridge


Segment .
Bridge Sourceroutingbridge .
Segment Bridge Segment .

Connectingdevices(Router)

Router Router :

Datalink
Physical

LAN Router WAN .


Router Physical Address
.

IPAddresses ClassfulAddressing
TCP/IP Network IP

.
Network 32 ( IPv4)4 .
n 2 n .
32 TCP/IP 4
4,294,967,296 .

BinaryNotation
01110101100101010001110111101010
32 TCP/IP .

Dotteddecimalnotation .

01110101 1001 0101 00011101 1110 1010


75
95
1DEA
0x75951DEA
HexadecimalNotation .

Dotteddecimal notation Binary


.

Example 1
ChangethefollowingIPaddressfrombinarynotationtodotteddecimalnotation.
10000001000010110000101111101111

Solution
129.11.11.239
. Binary Dotteddecimal

Example 2
ChangethefollowingIPaddressfrombinarynotationtodotteddecimalnotation.
10000001 00001011 0000101111101111

Solution
129.11.11.239

IPAddresses
: Dotteddecimal

Example 3

Findtheerror, ifany,inthefollowingIPaddress:
111.56.045.78
Solution
Therearenoleadingzeroesin
Dotted decimalnotation(045).

Example 3(continued)

Findtheerror, ifany,inthefollowingIPaddress:
75.45.301.14
Solution
Indotteddecimalnotation,
Eachnumberislessthanor
Equalto255 301isoutsidethisrange.
. Hexadecimal Binary

Example 4

ChangethefollowingIPaddressesfrombinarynotationto
hexadecimalnotation.
10000001 00001011 00001011 11101111
Solution
0X810B0BEFor 810B0BEF16

CLASSFULADDRESSING(1)
. Classful Addressing TCP/IP 32
. E D C B A
.

: A

Example 5
Howcanweprovethatwehave 2,147,483,648addressesinclassA?

Solution
InclassA,only1bitdefinestheclass.
Theremaining31 bitsareavailable
fortheaddress.With31bits,
wecanhave231 or 2,147,483,648addresses.

Binary
:

Example 6
Findtheclassoftheaddress:
00000001 00001011 0000101111101111
Solution
Thefirstbitis0.ThisisaclassAaddress.
Example 6(Continued)
Findtheclassoftheaddress:
11000001 10000011 0001101111111111
Solution
Thefirst2bitsare 1thethirdbitis 0.
ThisisaclassCaddress.
: Decimal

Example 7
Findtheclassoftheaddress:
227.12.14.87
Solution

Thefirstbyteis227(between224and239)
theclassisD.
Example 7(Continued)
Findtheclassoftheaddress:
193.14.56.22
Solution
Thefirstbyteis193(between192and223)
theclassisC.

CLASSFULADDRESSING(2)
Example 8
InExample4weshowedthatclassAhas231(2,147,483,648) addresses.
Howcanweprovethissamefactusingdotteddecimalnotation?
Solution
TheaddressesinclassArangefrom0.0.0.0to
127.255.255.255.Wenotice thatweare
dealingwithbase256numbershere.

Solution(Continued)
Eachbyteinthenotationhasaweight.
Theweightsareasfollows:
2563, 2562, 2561, 2560
Lastaddress: 127 2563+ 255 2562+
255 2561+ 255 2560=2,147,483,647
Firstaddress:= 0
Ifwesubtractthefirstfromthe
lastandadd1,weget2,147,483,648.

Netid A Byte Hostid Byte


Network 128 Network
16,77,216 .

Network

.
B Network 16,384
65,536 .

)CLASSFULADDRESSING(3
C Network 2,097,152 256 .

.
: Classfuladdressing
A B .
C .
D Multicasting .
E Special purposes Block
.
:Networkaddress
Networkaddress .
Network address Block Block
.

: Networkaddress

Example 9
Giventhenetworkaddress17.0.0.0, findtheclass, theblock, andtherange
oftheaddresses.
Solution
TheclassisAbecausethefirstbyteisbetween
0and127. Theblockhasanetidof17.
Theaddressesrangefrom17.0.0.0to
17.255.255.255.

Example 10
Giventhenetworkaddress132.21.0.0,findtheclass, theblock, andthe
rangeoftheaddresses.
Solution
TheclassisBbecausethefirstbyteisbetween
128and191.Theblockhasanettedof
132.21.Theaddressesrangefrom
132.21.0.0to132.21.255.255.

Example 11
Giventhenetworkaddress220.34.76.0,findtheclass, theblock,andthe
rangeoftheaddresses.
Solution
TheclassisCbecausethefirstbyteisbetween
192and223.Theblockhasanettedof220.34.76.
Theaddressesrangefrom220.34.76.0
to220.34.76.255.

AddressMasking
. 32 Mask Hostid Netid

: Mask

: Mast

Example 12
Giventheaddress23.56.7.91andthedefaultclassAmask,findthe
beginningaddress(networkaddress).
Solution
Thedefaultmaskis 255.0.0.0,whichmeans
thatonlythefirstbyteispreserved
andtheother 3bytesaresetto0s.
Thenetworkaddressis23.0.0.0.

Example 13
Giventheaddress132.6.17.85andthedefaultclassBmask,findthe
beginningaddress(networkaddress).
Solution
Thedefaultmaskis255.255.0.0, whichmeans
thatthefirst2bytesarepreserved
andtheother 2bytesaresetto0s.
Thenetworkaddressis132.6.0.0.
Example 14
Giventheaddress201.180.56.5andtheclassCdefaultmask,findthe
beginningaddress(networkaddress).
Solution
Thedefaultmaskis255.255.255.0,whichmeansthatthefirst3bytesare
preservedandthelastbyteissetto 0.
Thenetworkaddressis201.180.56.0.

Wemustnot
applythedefaultmask
ofoneclassto
anaddressbelonging
toanotherclass.

( 1)

Router
IPAddress Network .

Network A
B C
Network.

( 2)

:

Unicast

Multicast

Broadcast

Subnetting/SupernettingandClasslessAddressing

.
:
Subnetting -1
Supernetting-2
Classlessaddressing -3

IP
Level .
:

B Host 65,536
.

Subnetting .

Sub netting Hostid 16


Subnetid Hostid .

Subnetting :

)Subnetmasking (1
Subnetting Mask
Subnet .

: Subnetaddress
Straight1
Shortcut2

: Straight
Binary notation Address Mack and
Subnetaddress .

: Straight

Example 1
Whatisthesubnetworkaddressifthedestinationaddressis200.45.34.56
andthesubnetmaskis255.255.240.0?
Solution
11001000 00101101 00100010 00111000
111111111111111111110000 00000000
11001000001011010010000000000000
Thesubnetworkaddressis200.45.32.0.

: SortCut
255 Mask
.
. Mask
AndOperation Binary Address Mask 0 255
.
: ShortCut

Example 2
Whatisthesubnetworkaddressifthedestinationaddressis19.30.80.5and
themaskis255.255.192.0?
Solution

Subnet Defaultmask
: Subnetmask Defaultmask

. 2 Subnet :

Example 3
Acompanyisgrantedthesiteaddress201.70.64.0(classC). Thecompany
needssixsubnets. Designthesubnets.
Solution
Thenumberof 1sinthedefault
maskis 24(classC).

Solution(Continued)
Thecompanyneedssixsubnets.Thisnumber6isnotapowerof 2.Thenextnumber
thatisapowerof2is8(23).Weneed3more1sinthesubnetmask.Thetotal
numberof1sinthesubnetmaskis 27(24 +3).
Thetotalnumberof0sis 5(3227). Themaskis

Solution(Continued)
11111111111111111111111111100000
or
255.255.255.224
Thenumberofsubnetsis8.
Thenumberofaddressesineachsubnetis25(5isthenumberof 0s)or32.

Subnetmasking (2)
Example 4
Acompanyisgrantedthesiteaddress181.56.0.0(classB).Thecompany
needs1000 subnets.Designthesubnets.
Solution
Thenumberof 1sinthedefaultmaskis 16(classB).

Solution(Continued)
Thecompanyneeds 1000subnets.Thisnumberisnotapowerof2. Thenext
numberthatisapowerof2is1024(210). Weneed10more 1sinthesubnet
mask.
Thetotalnumberof 1sinthesubnetmaskis26(16+ 10).
Thetotalnumberof 0sis6(32 26).

Solution(Continued)
Themask is
11111111111111111111111111000000
or
255.255.255.192.
Thenumberofsubnetsis1024.
Thenumberofaddressesineachsubnetis26(6isthenumberof0s)
or64.

Subnet
Subnet :

CLASSLESSADDRESSING
: InternetAddressing
ClassfulAddressing 1
Variablelengthblocks 2
: Variablelengthblocks Block

. 2
NumberofAddressesinaBlock
Thereisonlyoneconditiononthenumberofaddressesinablockitmustbeapower
of2(2,4,8,. . .).Ahouseholdmaybegivenablockof2addresses.Asmallbusiness
maybegiven16addresses.Alargeorganizationmaybegiven1024addresses.

BeginningAddress
Thebeginningaddressmustbeevenlydivisiblebythenumberofaddresses.For
example,ifablockcontains4addresses,thebeginningaddressmustbedivisibleby
4.Iftheblockhaslessthan256addresses,weneedtocheckonlytherightmostbyte.
Ifithaslessthan65,536addresses,weneedtocheckonlythetworightmostbytes,
andsoon.

Example9
Whichofthefollowingcanbethebeginningaddressofablockthat
contains16addresses?
205.16.37.32
190.16.42.44
17.17.33.80
123.45.24.52
Solution
Theaddress205.16.37.32iseligiblebecause32isdivisibleby16.Theaddress
17.17.33.80iseligiblebecause80isdivisibleby16.

Example10
Whichofthefollowingcanbethebeginningaddressofablockthat
contains1024addresses?
205.16.37.32
190.16.42.0
17.17.32.0
123.45.24.52
Solution
Tobedivisibleby1024,therightmostbyteofanaddressshouldbe0andthesecond
rightmostbytemustbedivisibleby4.Onlytheaddress17.17.32.0meetsthis
condition.

Slashnotation (1)
CIDR Slash notation . Classless addressing Slash notation

Example 11
Asmallorganizationisgivenablockwiththebeginningaddressandthe
prefixlength205.16.37.24/29(inslashnotation).Whatistherangeofthe
block?
Solution
Thebeginningaddressis205.16.37.24.Tofindthelastaddresswekeepthefirst29
bitsandchangethelast3bitsto1s.
Beginning:11001111000100000010010100011000
Ending:11001111000100000010010100011111
Thereareonly8addressesinthisblock.

Example12
WecanfindtherangeofaddressesinExample11byanothermethod.We
canarguethatthelengthofthesuffixis32 29or3.Sothereare23=8
addressesinthisblock.If thefirstaddressis205.16.37.24,thelastaddress
is205.16.37.31(24+7=31).
Classful addressing A.B.C.D/ n
. Slashnotation

either 8(classA), 16(classB),or


24(classC).
Example 13
Whatisthenetworkaddressifoneoftheaddressesis167.199.170.82/27?
Solution
Theprefixlengthis 27, whichmeansthatwemustkeepthefirst27bitsasisand
changetheremainingbits(5)to0s.The 5bitsaffectonlythelastbyte. Thelastbyte

is01010010.Changingthelast5bitsto 0s,weget01000000or64.Thenetwork
addressis 167.199.170.64/27.

Example 14
Anorganizationisgrantedtheblock130.34.12.64/26.Theorganization
needstohavefoursubnets. Whatarethesubnetaddressesandtherangeof
addressesforeachsubnet?
Solution
Thesuffixlengthis6.Thismeansthetotalnumberofaddressesintheblockis64
(26). Ifwecreatefoursubnets,eachsubnetwillhave16addresses.

Solution(Continued)
Letusfirstfindthesubnetprefix(subnetmask).Weneedfoursubnets,whichmeans
weneedtoaddtwomore1stothesiteprefix. Thesubnetprefixisthen/28.
Subnet1:130.34.12.64/28to130.34.12.79/28.
Subnet2: 130.34.12.80/28to130.34.12.95/28.
Subnet3:130.34.12.96/28to130.34.12.111/28.
Subnet4:130.34.12.112/28to130.34.12.127/28.

Slashnotation (2)
Example 15
AnISPisgrantedablockofaddressesstartingwith190.100.0.0/16. The
ISPneedstodistributetheseaddressestothreegroupsofcustomersas
follows:
1.Thefirstgrouphas64customerseachneeds256addresses.
2.Thesecondgrouphas128customerseachneeds128addresses.
3.Thethirdgrouphas128customerseachneeds64addresses.
Designthesubblocksandgivetheslashnotationforeachsubblock.Find
outhowmanyaddressesarestillavailableaftertheseallocations.
Solution
Group1
Forthisgroup,eachcustomerneeds 256addresses.Thismeansthesuffixlengthis8
(28=256).Theprefixlengthisthen32 8 =24.
01:190.100.0.0/24 190.100.0.255/24
02:190.100.1.0/24 190.100.1.255/24
..
64:190.100.63.0/24190.100.63.255/24
Total=64 256=16,384

Solution(Continued)
Group2
Forthisgroup,eachcustomerneeds 128addresses.Thismeansthesuffixlengthis7
(27=128).Theprefixlengthisthen32 7 =25.Theaddressesare:
001: 190.100.64.0/25
190.100.64.127/25
002: 190.100.64.128/25 190.100.64.255/25
003: 190.100.127.128/25 190.100.127.255/25
Total=128 128=16,384

Solution(Continued)
Group3
Forthisgroup,eachcustomerneeds 64addresses.Thismeansthesuffixlengthis6
(26=64).Theprefixlengthisthen32 6=26.
001:190.100.128.0/26 190.100.128.63/26
002:190.100.128.64/26 190.100.128.127/26

128:190.100.159.192/26 190.100.159.255/26
Total = 128 64= 8,192

Solution(Continued)
Numberofgrantedaddresses: 65,536
Numberofallocatedaddresses: 40,960
Numberofavailableaddresses: 24,576

DeliveryandRoutingofIPPackets
:
CONNECTION1
DELIVERY2
ROUTINGMETHODS3
STATICANDDYNAMICROUTING4
ROUTINGTABLEANDMODULE5
CLASSLESSADDRESSING 6

CONNECTIONLESS CONNECTIONORIENTED
Connection Oriented Connection Less

.
: ConnectionOriented
Connection
. .
: ConnectionLess

.
Connection less Connection less .
.
Connection Oriented
ConnectionOriented .
ConnectionOriented .
: Connectionless
.

: Connectionless

.
: ConnectionOriented

Qualityofservice .

DIRECTVERSUSINDIRECTDELIVERY
: Indirect Direct

:DirectDelivery

: IndirectDelivery

ROUTINGMETHODS
: Routing

Networkspecificrouting

Defaultrouting
Host Router
. Networkspecific

STATICVERSUSDYNAMICROUTING

Astaticroutingtable
containsinformationenteredmanually.
Adynamicroutingtable isupdated
periodicallyusingoneofthedynamic
routingprotocolssuchasRIP, OSPF,or
BGP.

ARPandRARP
TCP/IP :
.1 Transport
.2 (IPAddress)
.3 )(MacAddress

ARP Logical Host Physical .


PhysicalAddress RARP Physical .

ARPoperation
ARP RARP Network .
ARP :

ARPPacket
ARP 28 :

EncapsulationofARPpacket
ARP :

FourcasesusingARP

ARP :

Example 1
AhostwithIPaddress130.23.43.20andphysicaladdress
0xB23455102210hasapackettosendtoanotherhostwithIPaddress
130.23.43.25andphysicaladdress0xA46EF45983AB.Thetwohostsare
onthesameEthernetnetwork.ShowtheARPrequestandreplypackets
encapsulatedinEthernetframes.
Solution
showstheARPrequestandreplypackets.NotethattheARPdatafieldinthiscaseis
28bytes,andthattheindividualaddressesdonotfitinthe 4byteboundary.

RARP

RARP :

InternetProtocol(IP)(1)
:
DATAGRAM
FRAGMENTATION
OPTIONS
CHECKSUM
IPPACKAGE

.1
.2
.3
.4
.5

: Network IP

IP Packet Datagram IP . Connectionless


. IP . IP
Set
.

)InternetProtocol(IP)(2
Datagram :

ServiceTypeorDifferentiatedServices
: DifferentiatedServices Servicetype

. IP Precedencesubfield
. Header Totallength

EncapsulationofasmalldatagraminanEthernetframe
:

EncapsulationofasmalldatagraminanEthernetframe (2)

: Network Multiplexing

Example 1
AnIPpackethasarrivedwiththefirst 8bitsasshown:
01000010
Thereceiverdiscardsthepacket.Why?

Solution
Thereisanerrorinthispacket.The4leftmostbits(0100)showtheversion,whichis
correct.Thenext 4bits(0010)showtheheaderlength,whichmeans(2 4=8),
whichiswrong.Theminimumnumberofbytesintheheadermustbe 20. Thepacket
hasbeencorruptedintransmission.

InternetControlMessageProtocol(ICMP)(1)
:
TYPEOFMESSAGE 1
MESSAGEFORMAT 2
ERRORREPORTING 3
QUERY 4
CHECKSUM 5
ICMPPACKAGE 6
PositionofICMPinthenetworklayer

EncapsulationofICMPpacket

ICMPmessage

GeneralformatofICMPMessages

Errorreportingmessages

ImportantpointsaboutICMPerrormessages:
1.NoICMPerrormessageforadatagram
carringanICMPerrormessage.
2.NoICMPerrormessageforfragmented
Datagramthatisnotthefirstfragment.
3.NoICMPerrormessageforadatagram
havingamulticastaddress.
4.NoICMPerrormessageforadatagram
withaspecialaddresssuchas127.0.0.0
or0.0.0.0.
ICMP

InternetControlMessageProtocol(ICMP)(2)
Destinationunreachableformat

Destinationunreachablemessageswith
codes2or3canbecreatedonly
bythedestinationhost.
Otherdestinationunreachable
messagescan
becreatedonlybyrouters.

InternetControlMessageProtocol(ICMP)(3)

Thereisnoflowcontrolmechanism
intheIPprotocol.
Sourcequenchformat

Asourcequenchmessageinforms
thesourcethatadatagramhasbeen
discardedduetocongestion
inarouterorthedestinationhost.
Thesourcemustslowdownthesending
ofdatagramsuntilthecongestion
isrelieved.
Onesourcequenchmessageshould
besentforeach
datagramthatisdiscardeddue
tocongestion.

InternetGroupManagementProtocol(IGMP)
IGMP Network TCP/IP .
IGMP Multicasting .
:
GROUPMANAGEMENT
IGMPMESSAGES
IGMPOPERATION
ENCAPSULATION
IGMPPACKAGE

Unicast

Multicast .
IGPM Multicasting .
Multicasting D .
4 Multicast 1110

Unicasting:

Multicasting:

MultipleUnicasting:

IGMPmessageformat
:IGMPmessage
Query 1
Membership 2
Leavereport3
Router IGMP
.

IGMPoperation
Router Multicastrouting .

Multicast IPAddress B ,A C
.

Membershipreport

Membershipreport ,IGMP .

UserDatagramProtocol(UDP)
:
PROCESSTOPROCESSCOMMUNICATION
USERDATAGRAM
CHECKSUM
UDPOPERATION
USEOFUDP
UDPPACKAGE

PositionofUDPintheTCP/IPprotocolsuite

PROCESSTOPROCESSCOMMUNICATION
UDPversusIP

Transport Connectionless Connection


Oriented .
IP Connectionless ,
.
UDP Connectionless .
TCP ConnectionOriented .
UDP Overhead TCP .
UDP Flow Error .

TCP/IP :
1
2IP
3

Portnumbers

UserDatagramProtocol(UDP)(2)
: PortNumber
Echo=PortNumber7
Discard=PortNumber9
TFTP=PortNumber69
SNMP=(SimpleNetworkManagementProtocol)=PortNumber161

IPaddressesversusportnumbers

IANAranges

Socketaddresses

USERDATAGRAM
Userdatagramformat

UDPlength=
IPlengthIPheaderslength
CHECKSUM
PseudoheaderaddedtotheUDPdatagram

Checksumcalculationofa
simpleUDPuserdatagram

UDPOPERATION
Encapsulationanddecapsulation

QueuesinUDP

Multiplexinganddemultiplexing

: UDP
Flow Error UDP
TFTP FTP Flow

Error Application ,
.
, SNMP RIP
UDP .

UDPpackage

Controlblocktableatthebeginning
Q
Qu
ueeu
ue N
Nu
um
mb
beer

34

38

P
PoorrtN
Nu
um
mb
beer P
PrroocceesssIID

52,010
2,345
52,011
3,422
52,012

4,652

S
Sttaatte

INUSE
INUSE
FREE
INUSE
FREE

E
Exxaam
mpplle1

The first activity is the arrival of a user


datagram with destination port number
52,012. The input module searches for this
port number and finds it. Queue number 38
hasbeenassignedtothisport,whichmeans
that the port has been previously used. The
input module sends the data to queue 38.
Thecontrolblocktabledoesnotchange.

E
Exxaam
mpplle2

Afterafewseconds,aprocessstarts.Itasks
the operating system for a port number and
is granted port number 52,014. Now the
process sends its ID (4,978) and the port
numbertothecontrolblockmoduletocreate
an entry in the table. The module does not
allocateaqueueatthismomentbecauseno
user datagrams have arrived for this
destination

ModifiedtableafterExample 2
Q
Qu
ueeu
ue N
Nu
um
mb
beer

34

38

P
PoorrtN
Nu
um
mb
beer P
PrroocceesssIID

52,010
2,345
52,011
3,422
52,014
4,978
52,012
4,652

S
Sttaatte

INUSE
INUSE
INUSE
INUSE
FREE

E
Exxaam
mpplle3

Auserdatagramnowarrivesforport52,011.
Theinputmodulechecksthetableandfinds
that no queue has been allocated for this
destination since this is the first time a user
datagram has arrived for this destination.
The module creates a queue and gives it a
number(43).

ModifiedtableafterExample 3
Q
Qu
ueeu
ue N
Nu
um
mb
beer

34
43
38

P
PoorrtN
Nu
um
mb
beer P
PrroocceesssIID

52,010
2,345
52,011
3,422
52,014
4,978
52,012
4,652

S
Sttaatte

INUSE
INUSE
INUSE
INUSE
FREE

E
Exxaam
mpplle4

Afterafewseconds,auserdatagramarrives
forport52,222.Theinputmodulechecksthe
table and cannot find the entry for this
destination. The user datagram is dropped
and a request is made to ICMP to send an
unreachable port message to the source.
Ex
am
mp
pl
le
e5
5
Exa

Afterafewseconds,aprocessneedsto
send a user datagram. It delivers the
data to the output module which adds
the UDP header and sends it.

)TransmissionControlProtocol(TCP
TCP UDP
TCP .
90 TCP 10
UDP .
TCP ConnectionOriented .

.
TCP ConnectionOriented ErrorControl

Flow Control
.

PROCESSTOPROCESSCOMMUNICATION
TCPSERVICES
NUMBERINGBYTES
FLOWCONTROL
SILLYWINDOWSYNDROME
ERRORCONTROL
TCPTIMERS
CONGESTIONCONTROL
SEGMENT
OPTIONS
CHECKSUM
CONNECTION
STATETRANSITIONDIAGRAM
TCPOERATION
TCPPACKAGE

PositionofTCPinTCP/IPprotocolsuite

PROCESSTO PROCESSCOMMUNICATION

Portnumbers

: Application
EQO=7
Daytime=13
FTP,Data=20
FTPControl=21
Telnet=23
SMTP=25

TCPSERVICES

Sendingandreceivingbuffers

TCPsegments

TCPsegments
Ex
am
mp
pl
le
e1
1
Exa

ImagineaTCPconnectionistransferring
afileof6000bytes.Thefirstbyteis
numbered10010.Whatarethesequence
numbersforeach
segmentifdataissentinfivesegments
withthefirstfoursegmentscarrying
1,000bytesandthelast
segmentcarrying2,000bytes?

S
Soollu
uttiioon
Thefollowingshowsthesequencenumberfor
eachsegment:
Segment1 10,010 (10,010to11,009)
Segment2 11,010
Segment3
Segment 4

(11,010to12,009)

12,010 (12,010 to 13,009)

13,010

(13,010 to 14,009)

Segment5 14,010

(14,010to16,009)

Thevalueofthesequencenumberfieldin
asegmentdefinesthenumber
ofthefirstdatabyte
containedinthatsegment.

Thevalueoftheacknowledgmentfieldina
segmentdefinesthenumberofthe
nextbyteapartyexpectstoreceives.
Theacknowledgmentnumberiscumulative.
Aslidingwindowisusedtomake
transmissionmore
efficientaswellastocontroltheflowof
datasothatthedestination
doesnotbecomeoverwhelmedwithdata.
TCPsslidingwindowsarebyteoriented.

FLOWCONTROL
Flow Slidingwindow
. ByteOriented TCP

Senderbuffer

Receiverwindow

FLOWCONTROL(2)
Senderbufferandsenderwindow

Slidingthesenderwindow

Expandingthesenderwindow

Shrinkingthesender
window

InTCP,thesenderwindow
sizeistotallycontrolled
bythereceiverwindowvalue.
However,theactualwindowsize
canbesmallerifthereis
congestioninthenetwork.

SomePointsaboutTCPsSlidingWindows:
1.Thesourcedoesnothavetosenda
fullwindowsworthofdata.
2. Thesizeofthewindowcanbeincreased
ordecreasedbythedestination.
3. Thedestinationcansendan
acknowledgmentatanytime.
TCP Congestioncontrol
Flow control
.

ERRORCONTROL

Corruptedsegment

Lostsegment

Lostacknowledgment

TCPTIMERS
: Timer
RestransmisionTimer
PersistentTimer
KeepAliveTimer
TimeWaitedTimer

RestransmisionTimer
Timer

RestransmisionTimer=2 *RTT
RTT=a *PreviousRTT+ (1 a )CurrentRTT

. %90 a
PreviousRTT=250ms
CurrentRTT=70ms
RTT=90%*250+10%*70=232ms
Restransmisiontime =2*232=464ms

CONGESTIONCONTROL
TCP Flowcontrol Errorcontrol
Performance
.
TCP/IP
OpticalMobile Wireless
TCP/IP .

.

)CONGESTIONCONTROL(2
TCP
TCP .
.
TCP .
Congestion .
.

Multiplicativedecrease

:
Slowstart
Addiriveincrease

Congestionavoidancestrategies

SEGMENT

Controlfield

OPTIONS

Endofoptionoption

Nooperationoption

Maximumsegmentsizeoption

Windowscalefactoroption

Timestampoption

CHECKSUM

CONNECTION
:
Connectionless
ConnectionOriented
ConnectionOriented


.
TCP ConnectionOriented
.

TCP IP Connectionless

Threewayhandshaking

ConnectionOriented :


Fourwayhandshaking

Statetransitiondiagram

Statetransitiondiagram(2)
Clientstates

Clientstates

Serverstates

Encapsulationanddecapsulation

Multiplexinganddemultiplexing

TCPpackage

TCBs
Transmissioncontrolblocks

10

$! " #
+ 6 - . +"/. 0 1

Peer to Peer File Sharing

application

+ '( #) * &%
Web HTTP &7
FTP &8
;STMP, POP3, IMAP: Electronic Mail &9
DNS &<
;TCP: Socket &=
;UDP: Socket &>
Building Web Server &?
D " ' C A B " ( Web Caching: A B " ( &@
;

2 - 34

A B " (E F +

.H !/IJ(K L
!/ H
(/1
+ 'GH "
$$$ ;FTP:
) J. .
4P(OChat OE-mail Oweb H ) M
N +
$$$ R /. ' T " U +! I/ OR /. ' S Q( +! I/ OQ I5 + ( M E F +
" WF
W. W K W3 W3.U" WXN+ W . WH D V V
I+ +0
+0
" F
'GWH
W/ Y W - WZ $$$ B W* O H" U6 O+ H 3.U" K 4
I+ * F +0
$
/
[D2 Q

W $!W ^ WN. 'GWH


(/1 R
W5 'GH 6 _
6 - . U) G.
$ //
6 - . NH 6/.

+
&%
&7
/((
+0
.
P'H

'H \ ] NIZ $!/


Y
\ ] NIZ" 'H
H ! I/
OS+Hardware ^ _
" F
platform R
NIZ K H K
ZApplication Program Interface U" Y
192

W5 !/W KX. 'H


NIZ L $
K 4 'GH a G( ! I/ "
6 - .` V "
BZ
W WH W /'bW(^ _ W" W3] " ^ _
$ V G( 6 _
6 - .^ _ F
(` /Z KX.R ! H
W transport W WX c V "
! I/ [. " (Physical, Link, Network, Transport) " ( G
Application W
W 6W - W. W
WF Application W $Application W
H
* API
W+ W'( # +
b. 'H
.N+ $ ."
Application
X N+
+ /L
ZSoftware
R WN W .WH W K N+ Application Software
. Z Application Software )
A(Application
$H
F !/JI /d !/JI V . ( Application
."
Application X N+
$ F #!/+ F U b/ !/
Y
Socket Programming
X+
API
NQ
W3P'( # W W3.U" K 4
B (
Application +
K"5
;B (: +Function "
* F^ _
P 4 K ILf2 e A API e A $ H K 3 US F " K H a Transport
$ F #!/+ F U

h + 6- .
(/1 Wh NWH gWH $ h K 4 Client/Server -6/.g " f . . gGH
Wg !W $ h 5 6 - .i . (/1 h
.K H
V G( gGH h /h
Client 6W - W.
X
$! jL Server 6 - .
h WH ) WA Internet Explorer 6W - W. M Web Browser + 6 - .i . ) M
NH Client 6 - .
g
NWH W c WV $ W hK 4W U" W+
/ H Opera . Open Source + 6 - .
c WV W+ 6 - W." IW+ ) WM Wh Internet Information Server W Apache M + 6 - . /I+ 5
$Server
W[D2

193

. gGH k
gH
+ $ . H K l/m (n _b V gGH
end system ( $!/h K H
WZ
g
Application
+ g( #$ . F Application (Physical + " F gGH a G( ^ _
l
+ (/1 h
h h
S WF 0
Q [
a G( $ H H a G( !+ Application
W/ Y W WZ gGWH h
k /. g I# M
h 6 - .) M
$
h + 6- .
Wh 6W - ." 65 S *
H F + g( # $ +
U + g( # h I
g H
I+ "/. 3 /#
H)
h
H )
+ ( /1 h / h +- /#
gH
U
$ +
h + 6 - . /Y

194

Application
K WA W]

W+ W - Q.

4 o ] Application
$H

h! " #

^_
$ h

/Y

3.U)
h +- /#i .
$.
F - 34 h +- /#
$ . p #- 34 h +- /#
+
/L K 3
g( #
U h)
h
!
!/h K H U h b_ /
+ g( # X S G $ h
W
W+- W/#f NY $ h n _b +- /#i . i .Application
F - 34 h +- /#$ h
!/IJ( Ph
Application W+ Wg( #c WV " W+- W/# W
. Request
c WV " WF W .
. response p #- 34 h I+ +- /# X K L
H
Q Client (/1 h
$ H
Q Server (/1 h
W] WH
W+- /#

Application

K3

W] - W/# W+ $- W/#k
65 - 34
. K H Application
+ g( # /qN+
Syntax X S G
./L
Z * F gH !+ h 65 $
65
response
+ g( #r (s65
Application
W
+ g( # /qN+ $ H
/Y n _b Application
W/GY( + g( # ) - 34
H H * F - 34 L - /# s65 + 0 #t ." # 65 - 34
$ h hu b !/+ 4
+ g( #
KH
request

/. WZ $ . H F F
( /1 h
- Q. H" # ] H PgH ]
)

/ a G(
-" /. ZApplication
+ g( # /qN+
t g)
- Z
/Ym ] s65 + h +
b.
$
/Ym h X +
H
Application

K WL $!/ H Public Domain


u W
W3.US W 2V .WH W
$ - . HTTP, SMTP, FTTP (
+ g( # " h !d P - N
$ hK H KazaA Napster M +

""

A( K Lk $ h !/IJ(K L
Application
+ g( #
F .
gGH N + .
h I+ + g( # H
+ g( # PN5 " $ I+ KLU + g( #
X.X] " XN+ K URFC
I+ * F + h H /g
h I+ + g( #t + g( #
J
g( #
( 5
$ . . 3.U F S /65 " 2 V
h K4

195

Server

Client

Wh +

S /*

WF W

/gb(

W - WZ Q

5 "Server - .

$ h K4

Server

6 - .s65 k
$

Client/Server

"# "

- 34 " f .

+ 6- .
$!/h

Client

h
h

gGH

6 - .s65 k Client
h 6 - .i NQ

g
2hs65 $
N( K h Q
h i H
N( h
6 - ." 65 UClient
F h
K W U v W." W T L b/N+ t H
h) D b/N+ Server $ +
Server a G( Q
$ + p # L Z V_ g "0 #
N( Q
F
W+- /# ;

F
$+

J
h )
p # U +Request

+- /#: f NY h
Server
h )

server

65 Client
J
Server

Peer to Peer

$ H

4L Peer to Peer 3.U


$ I+

h .K H D V

+ 6 - .7www )

J f2 h Peer to Peer

$ .X g /GH f2 h h a G(
W. (
Client

F
^ WJ.!W+ W. (

S *

6 - ." 65 + h!/g

+ 6 - .Client/Server
- Z h

K h)
!/. (

196

Client/Server

6 - .s65
.(

Client/Server

+ 6- . h

+ 6 - .c 2 F
gGH a G( k

"# "

gGH a G( k
$ + p # U

!/h I J !/+ _ L
$ Server !+ H H

$ W hK 4

U"

h + 6- . . ( D h +
$ /X S * h
V
V

g
. ( !+

+ 6 - .i .
+ (/1 h / a G(

W !/. (

;Peer to Peer + 6 - .: + 6 - .
h
. + 6 - . .L
h X
6
h Y(
h"/.
$! /X h Client/Server + 6 - . GI. (B/ gH
$ h+ u H
Z
h I. ( Y . H
"
J/
h Download
+ 6- . f
" W. .Server W "W/. WF +
HjLu H
h Peer to Peer + 6 - . U 5
$ H !/+ F
( 5 Y
5
$ + - Q. h
H F _H (/1 h

File

6W - W.k f

Napster

$!/g K H

$ h K4
$ h K4
$ H
- /#
$!/ H

!/. (

Napster

Client/Server

Peer to Peer

-6/.g "

Server

+ 6- .
s65
g

$ %&"

"# "

Y
h

( N Z"
Transfer

h Q I5 s65 k

-6/.g "
6h Server Z h Download s65 k
g h . 5 Peer to Peer + 6 - ." b_ k X c V "
A( (*
]
H .S * ]
- /#
)
h) D
K H " K /#Peer to Peer + 6 - . Z Chat g
, h /h [D2 Q
PgH

Peer to Peer

)
Chat

+ (/1 h $ I+
.
gGH h ! hx
(/1 h
F
Server - .Server 6 - . 5
./L
NH gH
$ H y2 V Client (/1 h 3.U BZ +Web Browser M Client + 6 - . 5
WZTCP 6W - W. Process / h //
P/ I
gH
Socket
NPh $ H
HUSocket NPh
W IW+ Wg
gGWH S WF
WL WF
h + 6 - . h! hK H PGZ +^ _ $ L
NQ
W+Socket $ W. - W.Socket .
gGH
API $ H
4L API 3.U Ph V h + /(
q
H
$ N. gGH a G( - Z . ( + q
U` V " +Process h hx
197

Process Identifier ' (

6W - . ]
!+
P

) *

+ F h ) zb (/1 h
h ( D " g $!/g KX. gGH
(/1 hk
L
"K 4
6N+ V /. ( NH ) M
$
6N+
h Download ) D FTP 0
Process Identifier
W WA( U Wh!/W
g. Q $ " { P_ 3+ Xb. 3 h H Home Page
$! h jX .
Process Identifier

$ Wh
Wh 6 - . ] " ) Y gGH ) ( ] Q - Z (/1 hk
6N+ V L
+ 6 - . h 5 K A.$ .H K 6/N( .H
5 X g " .X] + 6 - . h h n _b
$ /L S * - 34

Process Identifier

"K 4

$
$

(/1 h F K H ) Y
(/1 h
U

(/1 h F

U h IP

# ) (

U K NH hS # K NH
S #K NH
,) M
80;
113.45.12.201
U
Process k
U Wh %%8$ 9<$ %7$ 7w% W (/1 Wh
0 W # U Wh ?w ) s6WW5 , W s6WW5
Identifier W
h
(/1 h
$ K H ) Y U Identifier
W] W k W
WY W+ W # /
4P_ S ( gGH h X + h K H g.
eA
U "/.t H
Z (/1 h
U S W# K NWH tS #- 34 $
A S * Process + +
$ H !/+ F HU b/ IP
"# "

$! " # Application
/4/h i . !/g K H h I/. $ I+
h + 6- .

+ g( #i m
F

Application

+ X. Q
+ g( # H 4L
S F

F
/ ID [."
h + 6 - .i .
WM $ WH W ID (!ha G( /D + I
F
gGH a G( - X + h
h + 6- .
.WH L W /W U ] a G( ) V + I " 6/] .^ _ L .
4P( N(k
t .
4P(
$ .N Z . ( 0
H N. H F ] 4P(a G( *
W3.U W*
Wh $ h N. NA( Data F .L|/+ gGH a G( Q - X + h
h + 6- .
) J. + 6 - .
$ - . ( Telnet
W WX K WL W h NA( + F " F . ZK Lk $! H 5
h 6 - .i .
Q
0#
$ h N. NA(
F 5 q/+
(Data Loss)

" [. J."
h + 6- .
W+ "W tInteractive 6W - W. M $ +
/N+ P/F gGH S /PN /F}( h
h + 6- .
" ^ /W W+ I
hQ 5
( /1 h gGH V G( gGH Q
$$$
.
4P(Interactive
hc * Z "Q D
$ .H c
f~ Y
.H )2 F ] +Application
(Timing)

198

- WX + t W ) WJ. W+ 6 - W. W. $ W+ N. b. " / ID " h


h + 6- .
W Wh WN. WQ c 2 WF /~ Z *
H (
h Download q. ]
k
h Download
$+
T F h . ( Application
$ I/. ID " X F
ID " +Application F h! H 5

Q 0#

Wh K H g.
+ jL . 3#&(Bandwith) + jL . 3# [."
h + 6 - .i .
/ a G( Q - X + gGH h
$ hQ 5 " D
.(
K !QD ] Application
W
WH F Wh W WH W" W !Wh . 3# L t I/. ID . 3# h
h + 6- .
$ ) J. + 6 - . . +
I/. Z + 6 - .
H Nh D " . 3# L t I+ ID . 3# h
h + 6- .
H F h
/Y
W. WH
4L Multimedia Stream 3.U h + 6 - . Mh $ +
WJ k " . 3# L . 3#
I+ g + 6 - . &K ." 4P( N( K ."0 . 4h
$ .H
H F
h )2 F ] H Nh * F
Application

'

(, -

W
K hK H
h + 6 - . + h" F - . )
\]"$ /
[D2 Q
5
Wh W+ 5 tK WH K H . 3#
Y
$ . I+ ID Data Loss U + 6 - . hK H K H WFU W $ h NA( . 3#S //z( . (
F + 6 - . h I+ Y
K H /ZElastic NPh
$ . I+ ID gGH a G( /F}( " + 6 - . U h h K H !+
h H ZL
hK U
+"/. ] 0
t HK
(/1 ha G( 0
Application
+ g( #t (/1 ha G( + + 0
$ I+ Physical Data/Link tNetwork tTransport +
+ p # X N+ h + g( #
$
h +Application E F +"/.
Transport

$Transport.

W
$UDP

W+ Wg( # W IW+ Wg
X
. TCP g

199

gGWH a WG(
h + 6 - . h! hK H
K H /^ /# g( # .
gGH Transport

g( #

gGH Transport
TCP

W+Application Message h Z 0 #$ h Q 5 gGH Reliable S *


S
h +Application
J. ND 0
U N. 5 Data Loss h
$
h|/+ $ h) h . ( N. h Q 5 +Application / + I ( h
g Q5
+ I I+ (S PF + /I i NQ
hr H " ~ Y
0 #$ h )
. V P/F "
W+ h W TCP h! H 5
$+ 0
F 3.U . ( N. I/. /4

2V h
ZTCP
J. ND gGH
/4 I+ No Loss
c * h . "TCP
gN
. "
+ I X r H
I+ Time Sensitive h
Full Control
Congestion Control
Connection Oriented
UDP

) WV W+ I 4D
ZUDP g( #$ T F E F
Transport 0
6/.UDP
!WL WD W H F
gN I
t g)
J
G"
I L 0 #$ I/.) J.
g( # 0 #$ H
$ H L h
G. I/. /4 t I+ ID F Loss h + h
.W
. " Z D k I/. ZUDP
.rPI( " TCP M UDP g( # X c V "
$
5 !+ UDP
5 TCP h .N+ { Ym J. $ g /N~ ( + I

] UDP h H )
NH
gN Q
Wh W (g. $ g
] t I/. / ID B
ZUDP TCP
I+ Time Sensitive h + g( #
$ p # 3.U
Application

12./0

Y e A *2 F ) 5
W Wh W+ Wg( #r
$! - .\ ]
+Application $!
WPg( #SMTP tSMTP Wg( # W
g Application e-mail f2 M K H K !
I+ g U +Application
+ g( # NQ ` PY
W $Transportation TCP S WF
g F 6/.SMTP Application
h + 6- .] h
K + b.) 5
K 4W
W+ Wg( #Application W] " Typically S W*
h
Streaming Multimedia WM f
2 MW W " ~ WY $ . K 3 UDP TCP " F . 6/. + g( #
" W J. WL WY Wh W J/
!P/ K ."^ N. K H Streaming Multimedia $UDP TCP K H H .
200

WA( W
W WH K W X
J. H Z 6N+ H K
b. H Play NP/ gGH
WZ WY
H K 4 UDP " !+ H K 4 TCP " !+ h /Ym
h!//G Q $!/ H Multimedia
+ " ) D + $ . - Q. 4P_ S / Q({ P_ 3 h H
L
$ WH K 4W UDP W] TCP ]
$
ZY
U F # U
h I+ K
(2 gb
Streaming

201

HTTP Web

Web

HTTP

'
" #$% &
)
./, Home page -Web page * +
,
)
Web page (
7 5HTML 5 6 # HTML 5( Web page ( 3 342
-) 12 0
Web page (
6#
9 4 '-6 # HTML 5( 8
@ * :; < ?6 # "
> reference * :; < =)' )8 9
6 # . =)' "
D ' 6 5-HTML 9 * :; < B C
< ) A Web page 9
E EF
B -6 # " >
H ! I ( )8 9 * :; < '),B " ;:
G 24 Web page (
" * :; <
)
Web Page ( 3'! 6 5
I
Object
( K J 7.2 3. 5
Audio JPG 6 5
) %
/7.2
6 5
')
Object B
" 8L HTML 59
Object B H ! Reference -Object I (
6 # 5HTML (
Web page
# .#
6# "
" /.# H ! (
M) EI 9! 5HTML
# .# Web page (
$%
)N'E

$ 1 2 6# 1 2
H ! B " . )'www.iust.ir/computer/home.html * )O Web Page ( H !
I 6 E +-6 # " " 8L '! Web Page B
6 # Server # Q+
), )P # Host #
#
Web Page B
5HTML 6 # 7 5 # 9! $ R'
Q+ "
4 /computer/home/html
Base B
6 5 www.iust.ir S' Server
') 9 H ! '),B
K
HTML Base File (
6 # " " 8L Server B 9 computer ).
6 # home.html $ % B 1 'File
HTTP

* E7

E7 B
)

T HTTP
* 24
$ TWeb Page (
)
7
!
./, Home Page Web Page Q + B.
6 # " ! Hyper Text Transfer Protocol
VT;
7 E >B
6 # " " U F) R+6 E +
6#
O) 8

4.
B
$ T Server B
6 # Server (
>
B XE Apache M; % 6 # Web Server W5S '(
" /.# M )EI
#" 8L1 2 (
T Server B
#" 8L1 2 B 8 )
6 2# (
Web
Page
" " 8LJ 7.2
Object HTML
5
O 7 3 6# B E 6#
Web Page Home Page
)P Y < 9
" " 8L1 2 B 8
$
')
. #B
') )8 Z . (
2
(
B - ) $ I5HTTP
' ,
9
< 6 #)8 B
# [# C
<
$#
#
9
6 #)8
<
Web
#
Web Browser
7 S' M)EI
9! Client 1 2 Client/Server =)' 6 # 7 HTTP K
Microsoft 6
\ #)
Internet Explore M
; % ')
F : /7.2
' /7.2 =)' Browser
202

Web Server
RFC2068

7 #

RFC1945

/7.2
'.# * 24

HTTP

6 #"

HTTP1.1

)
"

9!

RFC1945

] R ( Server < 6 # " @)


9!
4 9!
C =)'IIS Apache M; %
+
HTTP 1.0 ?6 # $ I5Version
HTTP 6 # "
6 # " +RFC2068
Software

HTTP

HTTP

6 #)8 TCP .
" /.# TCP Transport * 7E:
6#
HTTP
-6 #)8 B \ #) .# 5 Server )P
.#)8 Client )P B
TCP
Connection
=
]R
+ ]R
B
I 6 # ^_ " E Web Server
'.# default * ) " E
6 5 6 #)8
6 #)8 B M)EI
# Request 6 #)8 9 ):
. HTTP
6 5
6 #)8 B $ #
I TCP
7 TCP
6 #)8 B 6 # O 8 Web Page Home Page
[# -9! [#
6 # TCP " 3:
] R B SE 6 @)a
HTTP )`

b; NO 6 # 6 @T 9
(
B 7E>
3 6 O) 8 0 HTTP
] R
9
I Response Request # 9
I Web Server 6 # I B State Less '
E' C'
E'd/T ] R 9! Q>
:; < '),c
TCP 9 !
) + TCP Connection ( , K
Q N+TCP ] R I ' P gResponse Request $ R f ] R
+ Server Client HTTP eConnection
)
( HTTP
K
E' 3C'S B )
:;< '),c Web Server 7T B
#
State Less
HTTP

state less

HTTP
HTTP

P HTTP

')

Nonpersistent

6 5
Request (
$ R K TCP $
Nonpersistent
HTTP
' , )
@ R Response Request ( 3 ] R
K - QN+ ] R
)8 TCP
TCP $
Response Request
I 6# S
$ i.'Response Request 0 Server Client
j E'W'
C
$
+
B Default * )O HTTP 1.0 ) QN+ I )

Response

eh
.+

203

Persistent
Response

Request
persistent

* I5

ek

l Nonpersistent ; 8
$
Set 9!
W0 V' Ni' HTTP 1.1
6 # +MIN+
Nonpersistent * )O
@% L
B
U F) Nonpersistent

') TCP Connection


) " 'Default )

204

Server

Client

l Web Server B S'


6 5 Server (
Web Page 6 #
Client
m 5
m 5
H ! HTML 5B
8
Jpeg eObject " HTML
5(
Web Page B
www.iust.ac.ir/computer/home.html l Web Page B URL
m 5
" " (Refrence)
6 #)8 TCP HTTP eClient )P
. )
./, Uniform Resource locator MT; NO H ! B
$ # www.iust.ac.ir )P ^_ * )
.#)8 TCP eClient )P
n B
Connection
6 # www.iust.ac.ir 9! S ' )P B U # Web Server 6 #)8 B
H E
6 #)8
$ # 9! @)R+ " 6 5
H E 6 #)8 B ^_ * )
B TCP Connection 7T B S E K
6# "
Server Client
$ # Message B TCP
TCP
)`
# 6 Request (
Message ( Client $ T
Computer l Folder
home.html S ' HTML
5( 6 5 6 #)8 ') Message B
" ')8 )8 )P Hard
home.html
56 #)8 B 6 5
I Server 6 # " " 8L Server )P
9!
9! 9
E>
9
Interpret 6 # " 6 5
5Client )P .# 5 Client )P
9 4'
)P `/O
S * :; <
8
'
>). Client )P 7T B $ T B :
)
Web (
n @+ " 6 5
3'!
6 #)8 Server )P
=)' Object h_
Page
] R 9
. 6 #)8 Web Client Web Server 7T B
I
1 E'
)P `/O
6 # S Client
.5 ,[# ( " 6 #)8 ( Client 7T B
)
. ]R
TCP
.# / Object ( 6 5 6 #)8 - TCP Connection
@)
h_ V' ) Object h_ 6 5
I
o /
h_
#64 n
" U F)
7T K
R TCP Connection eObject 9! 6 5
.5

www.iust.ac.ir

HTTP

]R

" #
TCP ] R

RTT

)E: )< 9 )`
$ 7T )
i 7T
Response 6 5
Request $ # 9

\#) "
O9
R# ` 6 #
HTTP ] R ( 6 # " " 9 4'Server Client B
, 6 # 6 #)8 6 5 K P# 6 #)8 $ # S 7T
HTTP

205

$ # ) 8 Link
.#)8 HTML 5
) )8 2RTT+Transmit Time
9

O
-

' , 6 # 2RTT "


m 5g 5$ # 9 f Transmit time

Server

O9

Persistent HTTP

V' Ni' Persistent HTTP


n
Pipe Line S'
W' 9 )
Persistent HTTP
. 'Pipe Line , 9!
[# @). 6 5
Client
< @). Request 0 $ # 6 # * R: Pipe Line
6# I B
$ #
S + 9! Response 6 5
K " $ # Request ( V`@
Client
C Request
gPipe Line 9 e Pipe Line f
i" ,
9)
Persistent HTTP =)'
Nonpersistent HTTP

.3 9

HTTP & '!%

"# $ "%

VT;

6 #)8 B 6 # " # HTTP 6 #)8 . (


6 # qW>
Mq . (Request Line) 6 #)8 \8
HEAD -POST -Get -Put % ' S + =)' Method
9! 6 #)8 B
6 # 7 5H ! URL
+URL
B
6 # Version HTTP " 9 4'
+Version
I \8 .
I
. Header Line 6 # 9
3'! 7 6 5 @ ' S + =)'e (header Lines) ! # ])N8
9!
: * R: ( 9! I )
A ? . 9! I - " J O) (
#(
S
I. ')
Header line
)> CR,LF 9! K
)
A ' 'value
)8 r 8 'I 3'!
9 4 'CR,LF
9!
) > @ 8 \8 ( header line B 8! I '
'"
)8 $ # request message B " E
:; < e (Entity Body) . ' * :; < 9! I
) "
+

?6 #
)89
6 #)8 =) ' .
'
9! K
+Space . K
9!
I 6 # 7O 5K P#
"
CR, LF 9!
I 6 # .8 # 6 #)8

pW>
. 9!

206

HTTP (

"

" ' # HTTP Version


9!
I 6 IF

6 #)8 S
Response message B " E

6 R HTTP Response ( [# . (
Version .
e Status Line 6 IF 6 @T \8
7O 5-6 IF
I - 7O 59! I -[# S B
)
A CR,LF
R M; ])N8 B 7
l header lines ! # ])N8
:;< 6 # * R: l (Entity Body) . ' * :; <
) $ # Client <
HTTP & '!%

56 5 6 #)8
7O 5 I 6 # " !
)

( 6 5

6 #)8
. (
" 9 4'
)8
"
U F)
R:

HTTP Request

Server

HTTP Response

"# $ "%

6 #)8

7 V'

'+ ,-

. j, Request Line 9! S' $ \8


6 # 5S'K P# 7O 59! I 6 #
page.html
6 # " G 24 message " ' # Version HTTP
$ \8 6 # " ! ! # \8 s 9! I
6 # Server # H !

I
6 # Get .
+9!
5
).

$ # 9!

"# $) * "%

" 4

207

.8 # 9!
message B
Browser S' B
" User Agent S \8
K
6#
S B " ' # 6 # B I S)# \8
Client B $
Request B 6 5
)>
5B
) ' 5 2 ' , " 6 5 page.html 5 6 # B I S 30 \8 ) QN+Server
9
[
S 'K P# <
7E> (
T
\8 ) 6 5
) '5 2 ' 6 #
9!
't i+ 6 :# n T
Request (
@ 6 # Html 56 5
Request B
u[ B K
5 , K -6 # " +[
I 5B 9
* R: 6 #)8 ]
6# ] 4
" '
)2'$ # Client
9! 6 #)8 B [# server
8! \8
@%
Q+ E K
. ' )> W0 1 2 B
I 6 # B E 6 # CR,LF
Request message
message e header B )8 Q+
.8 # HTTP header ( =)E
! & T
Version 4

Mozilla

"

HTTP (

"# $) * "%

'+ ,-

9 ): 6 ` k__ : I e6 # Version HTTP . Status Line I $ % $ \8


OK
n # [ # 9! 6 # +Server
65
v Request 6 # I B
6 # k__
.2
. $ % B ]) N8
)
A 9! I ! # ])N8
TCP [ # $ #
K Server " G 24
S B B.8 #
V`@ Server [
"
6# 9
6 # [ ( 9! K QN+ Connection
(Unix)
: . # 9! 1
" E Apache eServer
" n 'Web Server W5S 'S'9! K ! #B
I
:; <
9 4' I \8 6 # .#)8
5 u B 8! 6 :# [ 9! K -6 #
).` =)' K P# -6 # 6 w^kh
)
A
"
./,$ % B
) " 6 # header I
Message ' 9!
I
7O 5\8 ( Header I 6 # html =)' Text 6 # Text =)' 7 )<
A
Content
$%B
" ,(
i " , pW>
M )EI Header Line 6 E + )
5S
' )
R# * :; < ) `' ])N8 B - ' MIME Line 6 # Content Length Type
6 # " G 24
' =)' $)< $ % B
)
U F)

.8

6 IF
E7

208

Head Get & '!% / 0

6 #)8 S (
<

')

Get

)
] 4

A URL 1 2
5S' H !
File 6 5 6 #)8
I Get
,- )
If 6 R% & )> Get - ) " /.# If Modified Since Header Lines

9
9! .8 # Response Message l Head [#
" 4'J I HTTP
< Head # Client 6 # [#

* / B -6 # Get
R Head
! # 1 2 \i5K
$# ' 6E +
6#

Server

>) o)5
< Get ).# .3 v
" " /.# If Modified Since \8 e Request B Header
$#
.8 # )8 HTTP Request l Client
' ) 5 )
>). )8
5 * u X2
I>
Server #
Server Request B l
\ i5 6 # '
5 +5 .# 5 Client
2# * )O B - .5 ' u 9) " +[
Client
i
Ni' ) E'$ #
5 j@ Not Modified 6 # " ! Status Line l Header 6 E +
Header
B 6E +
If \ 8 e Request B Header
$#
.8 # )8 HTTP Request l Client 6 # " !
)8
5 * u X2
I>
Server #
Server Request B l " " /.# Modified Since
5 )
>).
6 IF \ 8
5$ # S + j@- .5 u 9) " +[
Client ' )
) $# 6 ;
< " 5F '
V' ) 5 ! # I 3.' " G 24 . 'B
Post & '!% / 0

75
Server

<

6 ; )P
9 B
Client
@ # * :;< X' 0
)

).#
Post 6 # )8 Su (
. C
E'$ #
# < 6 ;
E: Get J @2 6 # K
" 8L Request Message \8 B @ * :;< B

Post

209

F :

@%

6 # ? 6 ; :9! I 6 # .#)8
5URL " . )'URL l Get I . L I Request Line
I * :; < B B.5 , + ` e .# 5 Server
)8 Request " E Client 6 # :; < 1 2 B
I ')
(URL Encoded data) * :; < B
T , )
./, URL Encoded data 9! j@6 # URL
Entity 1 2
data * )O
* :; < B
(URL Encoded data) * :; < B
T , @ )4 A URL
.
" /.# Post .
Get . " /.#
>
6 # 6 IF B
)
A gS
' f Body
( n @+ * :;< B
$ # Server < Client
data
T
9 B Post
URL S '
.'
" /.# 9! 6 5
I Server 6 # /7.2 * :;< 7 ) E' A 5
" /.# (URL Encoded data)
$ # URL " E
" E
C
" Encoding
:)'
) d/T
9 E *-_ -0-9 -a-z -A-Z
.
, Encoding B
" /.#
Encoding
'" 9!
C
.
>
,
+x 7O 5 >
9! W C
yn
%HEX
) "
+

210

HTTP1.1 1.0
HTTP/1.1

.
.

1'!2'

PUT
DELETE
OPTIONS
PATCH
COPY
MOVE
LINK
UNLINK
TRACE
WRAPPED

' 9
)
9

j,

Server

PUT

Client

Download

?
[#

:). * '
' 5F .
9 4' ' )< 6 @B
)N'E
75
" > PUT .
.
" PUT . 6 '
9 GET ) " /.# GET K : Mi+ PUT K ) (Upload)
j,
Upload
)8 >)
i " , 30
Header Fields
n 7> Header Fields <

!#

6 #)8
!

Header

B e

6 #)8 S

!
'

!#

6 #)8 S

)> '

!#
!#

!#

I
?

)E: General Header Fields

\i5 B e Request Header Fields


\i5 B eResponse Header Fields
C eEntity Body Header Fields
I@N Header Fields =)' 30 B n
General Header Fields

'

Response

Request

Header Field

Keep-Alive
Upgrade
Connection
Forwarded
Cache Control
Version MIME
Data
Pragma

< =; < B

Connection: Close

l Header Field . M; R+
@%
) "
i
QN+] R Request Response $ R K
Connection

211

?6 # " !

General Header Field

MIME VERSION

.4 * ` F) MIME Version )

' J O)
.5

MIME

"
Header 9!
2 ' =)' 9! \#)

MIME

6#

Request Header Fields


Accept
Accept Language
Authorization
From
Host
If Modified Since
Proxy Authorization
Range
Refer
Unless
User Agent
Accept-Encoding
Cookie

"

Accept Language

If Modified Since

User Agent

( )
.4 * ` F)

Request Message

)8 MI Cookies )

W'

@%
)"

Response Header Fields


Location
Proxy - Authentication
Public
Retry - After
Server
WWW - Authenticate
Set - Cookie

'

)8 r 8

')

A [#

Header

])N8 B

Entity Body Header Fields


Allow
Content-Encoding
Content-Language
Content-Length
Content-Range
Content-Type
Content-Version

212

Content-MD5
Derived-From
Expires
Last-Modified
Link
Title
Transfer Encoding
URL-Header
Extension-Header

! Content-Type

Content-Length

" U F) M; R+

@%

& 034
B

>B

F : Status

Code

S'

>). Request (
VT;

Server

[#
. @

U F)
k__ M; %
F : 6 IF
z I " .8 s_s
" = k_h : 6 @B
I {_h
6 # [#
+ " v
6 5 Server \#) Client S
6 # B I ) " E OK
5 Eq 9
>
"
> <) folder q )< 6 #)8 ) 5 , K Client V' )
URL
` Request B " E $ T B :
n 7N B " {_h
" i. C Server `
6 #)8 , - 4'v 6 #)8
6 # I B |__
) "
+Client .8 6 #)8 ) 5 >
.IF 6 # B E ) u Z )2.# R )R: SC @#
9 ):
R'9! v
+Server
7 5B 0 @ " # 6 #)8
I 6 # 9 4'6 5 I |_| $ %
6 # " 4'
Object B 0
" ?
>) @%
)> Server Client Message Authorization eHeader Filed
Server Client B ] R
$ # Server
: Request Message ( Client " m 5
User name M
; % Client * :; < 6 5
'9 [#
Server @
G 24
' I
q |_h [# K
Client l ID
)> N8 [# B B XE 6 # 6 )
)O
), Client
qE'$ # W' )8 * :; <
. 6 #)8 $ #
) 8 * :; < B @
)8 7R+6 #)8 $ # S + M Client
I ')
+
)8 * )P#
S'M; %
+
# Server * :; < B
.+ ' C +URL Encoded * )O URL
/A
. ' E' [# $ # S + ",9! BaEN 9! 6 `O
213

$ #

Request

6 ' 5

. SE

Authorization

Response

Request

214

* :; < $ #
C

E: 6 # B
)>
gPassword User namef 9!

Cookies
!"
#$% & '(
(State Less)
Web HTTP
. /0
+ 5 #
Text 3 *- +,4 #0 1"2 Cookie $%#+ . / Cookie )* +,%, Cookie Reza@google <
=>
+ .'%:; (Client) ' %9 #0 Server 7 ' - 8 " + 16 Server (Client)
B / Client ' %9 # 0 0 A
# + ? @ Cookie 0-/.'%:; / Text Document 1 KB ! " #
1"
'( > @
. '5(Client)
%: Client C / -%*
@= . +"/ Server
A
H% %# 2"
: 'E 0
F G<= > %# 2" Web Site ! "- +D : @= # %
#+ K
1 '
# + J" , H" 8 ' %9 #0 '/ Cookie C 6 * 'I* 'E F & *
" '%(+ '5 %:
'E 'I*
@= . +"/
8 " + 1D Web Site G *' " 0 ,
G
# ' 8 %# "': */ + L '2 +,%*', F # #+ "/ F - # % 1"
4 4 #H"
@= H" 8 % + '5 : "': /
E*G- +:' . '#F #. M ) 5 6 )K
. 1D "/
0 OP*- : % 2 %*
# + J" 0 0 E/
, H"
+
Cookie )N%*, - . /
%
8 " . '#R 5 +Q5 6
#

S #+ $% P . '(

+# #
+# #H " 8 %#+ VO5
" + 1D + "/
# ' U (Persistent Cookies) $T 0 +# #
'%(+ '5. /
<J A '
+ .'%:; ' %9 #0
*. 16
"/ ! " ' # # / +* -0. W
'@
U (Temporary Cookies) 5 0 +# #
' %9 #0 +# # 1 "2 - + @= H 2'("/ H" 8 " + 16
"/ ! " # + 5 'K"
@
'%(+ '5. /
+# #1"2H" "/ G
* + +5
' %9 #0
#+ .'%:;
H" * + +5 7 '6 + . 7 X $ +# #1"2H" "'#VO5 "/ G
#+ 5
$%" (+ 5 +# #H"
" ' # 8 #C 6 *+# # E*G' %9 #0 # #C Q/ '/ - .-Y H" * + ' # # %
Y
- +Z
%D 6 : + :'
*, - " %
"/ - +Z * * / H, C %' H" #
Y
#. /
"/
S *0'%K%[N%*0'K" " - +
+# #0 0 $% P
3 *0 +# #
C 6 * ' %9 #0 ]' #\
A
Server 7 ' - +# #1"2U (First Party Cookies)
+
#+ . / +# # 1"2H" - 0 0 A
Server H% N%*. "G
C 6 *]' #\
' %9 #0 +# #1"2 A
Server U (Third Party Cookies) ) / 3 *0 +# #
+# #H" Server H" ]' #\
0 0 A
X / 0'K" Server "/ ^Q +# # 1"2H" + #+
_* 4 ,Q '%(+ * '5. /
1D
. C 6 * ' %9 #0
7 ' - +# #H" #0Server
'%(+ '5. /
+# #H" "
`%Q # 8 #+ a'@ + "'/ #H" H%@
: % 2 # # +"E "/ "+ `%Q 0 E "/ - +:'
L : + `%Q "'M
' #+" +# # %*-+ '/ E*G
#+ K
2+ b H" + )J* $

215

+ %' ! "

" 1D + `%Q 0 E "/


'( # #+
)J* 0'+6 &
:' ! "

J"

, H" #+ C 6*
* C %' H"

' %9 #0
-0 P/! "

*
+6 &
@= +Q, ! " #
+" +# #8 +# #H" " (+ C / *0 +# # +# #- +:'
'K" +6 &
@= 0 2a
@= H" # + .-Y
+ '5. /
Password User name
c [ '%K '5. /
C / * 7 ' - #+ %Q @ 0 ' 5 + ( # 0-/.'%:; Server V5
$% & ' ( D= :
'5'%de W
' #+6 &
0 P ! " / H, +# # # ( +
*. 0
+ * ' #0 ' 0 / 4 +# # #$%#.

' #A )K
g %&M )N%*, J "

* + cookie )N%*, - . /
+ c "'/ ' # #+"E "/ f
# +6 &
+ T E*G # + "'/ X
g %&M
' # ^"= @ 2 8 E "/
+ )J*0-/+6 &
%Q @ A / G' 2'( : '5 Authorization " "
'/ +
+,%*', 0 E K '2 R Q& 0 * + '2 # / + H" f "': /
! "
'$
/ %[)N%* , V5
"': H"
)J*
: -%*
"': - +M& 2 '
*N
#+ * -/
%D ' K" 0 E " /
8 ^ "= @ +"/
Server #
+ .-Y H%_
+# # Recommendation
'/ + " / ! "
#+ K )N%*, H"
Y * + Recommendation )N%*, 3 *! "c [ ,
%[+/'/ c "'/ - 0' V%/ R % ! " %* +
'%(+ '5 %:
M 0 E "/ 0
! " %*-+
%,
' #0 ' +
Session ! " 5
+# # # / +,%*',
[- +D : )N%*, V5 Web e-mail
#+
#

*
$%P
%D 6 : hNY * + %D 6 : H" U
, -+
* $ % & "
" ' ()
+" Y
% + )J*
#+" J Y
%#+ '[! %*', 0 )'20
#+ @= Password, ID
%:
#+ V Y
@= H" <i
+ `%Q 0 E #' %#+ a'@
: ^"= @ C %' H"
%*-+ '/
+ `%Q # % %*1" #+ K
M
0'
N ? @ 5 + ( * + H" + '5
: "'M
- #+ K
, ` *
H ; 5 - 0 P " Y F QO *0. " [H" %, . M W D 0
+ [ ^ "= @ * + +
#+ + * / J Y 0
#+"E "/ %#+ . / J Y 0
F QO 'I*
* + < ( #+" '%
, "
#H"
'J * + ' +[H" *'
*
User name,

216

-% &

H" #

+
/

+ @=

G0. /'2

Server

- '[+
Client

Cookie

' %9 #0

.' %:; G0

Server

'2

@=

Client

' %9 # HTTP H% $%#+ . / +# #- # + K


+ +QD '6 @ E4 0
@=

+ ' j HTTP Response Message

'

' %9 # HTTP

#
/

Client

# /

Header Line

Y 0'K" Header Line fHTTP Request Message


0'

Web Server

Server

7' -

' 5Web

"

3 *! "
H%_

/ 1"2Text ! " # Cookie 1"2 :


+ .'%:;

Server

1W

# / . .K"[3 *! "
#+ 0 EK*

%#+ I = +Q, Y H"


G +# #! %, - 0'M% %TNY
$" +
! "Client ' %9 # HTTP
0 ' /'2+
'* 0 @ / :
2" Server # Server ' %9 #
0 ' klmn <= > ID . ! " / : H"
#+ % ' #
Server # + K
: o/ [
- /+ Client / :
Header ! "
@ o/ [H" Header
Set-Cookie: 1678 1,
+O: Line
o/ [H"
. '# %
Client 7 '
/'2+
1 @ 1, H " $ %/ - +Z
#+ 2a . H" L : Cookie 1"2 o/ [H" 2" - Client
H " c [ #+ .'%:; 1"2 G . H"
+ J" p : +# #1"2! "p : 6 H" 0 ' # +
16
C %' H"
amazon #' Server "
ebay #' Server fServer #$%#q '2 '( C %'
H% - 8 - G #' "/
0 +Q" 2 ID .
H " # "'%(+ ID . ! "o/ [ / :
0 A
. .'%:; ' %9 #0 # - G #'
^ Q V5 1"2H" # + .'%:; ' %9 #
"0
H " Request Message ' 0 8 + Server 7 '
' %9 #7 ' - #0 0 Message /
.
! "Client ' %9 # # ' C %' H"
+ ' j Cookie:1678 1, Header Line ! %
/0
' # # + Y Server J%*
/'2+ N%* ID . H" /'2+ Server 0 ' / :
#0 Data Base ! "
#+ + * -/ +D : ^ O 1,
Request H" 8 , / 0Request '( V5
' #H" %D 6:
+ Update A
< ' Data Base H" #+ .'%:; L : $ %/
8 VO5
H" #H" #+ 0 EK*L :
L : ID Number < J Client #+ K 0
G0 ' +D : 2 . G Y
Client H" 8L : Data Base - . / Server V5
8 -/+ Server 0 '
#+ $%I
217

TCP HTTP

S$%#+ 0'%K%[Animation 1,

/F
'%[ ? W
5H"
L : Transportation
HTTP
! # + %[HTTP #+ X( TCP
%:
- /+
' Application
. '#
GTCP + '5TCP
# C %'
*/ + 6 P
#+ 0-/- Message . '5$
+ '5. *'%( HTTP %:

HTTP

FTP
' K" ' %9 # ' %9 #! "- 1"2 P*' # / +" 1, '[H"'+ " 5- +,"File Transfer Protocol "FTP
hN Y FTP Client hN Y f / hNY 0 Client ' %9 # FTP # %%+ %" ' Y 1, '( -/+ ' %
)J* . '# "'" L : ' %9 #0 1"2 P* %Q @' # + .-Y # / 0 *"[ # FTP User Interface
0 * +
Q* #+" 1"2 #
Y Client ' %9 # 0 " 0Local File System ! " '
/ 0' %9 #$%#.K*FTP Server '( *'( / . F & * J*G- * + Q[G #+" 1"2 * .'%:; G
File ! "0
# / 0' %9 # FTP Server
H%@ . C 6 *FTP Server )* 0 ' # N2)'* G0 #
/ ' #7 File System H" <i
$%" (+ Remote File System G ' #'I* OP*- # / System
" * Q[G G0 +" 1"2 ". '# Q* G- +" 1"2 # Q" ' #
. H%% Server 7 ' 0 ' Default [.
@ rk [.
/ FTP 1, '[+QD RFC U RFC 959
/

'I*FTP ? W 0
FTP Server FTP Client H% 1, H"
8 6 ! "
/ . $/ 6
Date 6
0' K" Control 6
[.
- ' # 6 0 ' $%" (+
0'
+ . / Server 0 rk
rs [. - . 6

$ #+ C QY 1, H"

218

M*! "
/ $T 6 ! "TCP Control Connection " ' # 6
C
!"
/ 5 6 ! "TCP Data Connection 1 P
*+
2 * + +5 Server
+ VO5
'%(+ '5. /
8 '(+ '5' -%*
TCP Control Connection ! "- .
/
Client
: 'I* 0 1"2 "1"2
+
: User name, Password 8 #+ #' FTP Server U File System
Server U File System 0 +Q" 2 ' # Upload 0 '
' I*
1 W " #+ F & * '# Download 0 '
#+ g &M
User name, 1 > +/'/
@=
/ %Q @ TCP Control Connection - . / Client H%_
File
: .-Y ) @ ".-Y @= H" 2" FTP Server # + .-Y V5
#+ )= @ Password
Server $ %/ 1"20
: 'I*
2 "1"2 '#+2'
: FTP Client #+ K " * D Transfer
^ "' - 1"2
+ J" Download )K
TCP Data Connection 6 8 '#g &M
'# Download 0 '
FTP 7 ' - 6 H " ^ "' - 0 1"2N%*Upload )K
* + 1P Client 7 ' Server - 6 H"
* + / FTP Server 7 ' Client
# %" '2+ I = +Q, J "
S #+ . FTP
t & 1, u 4 / Server t &
. ' 51,
/
/ $ Client
S / hNY / 1 Server t & / .
$Y' fServer Protocol Interpreter
1 , '[
Server Data Transfer
"
.
P* %Q @ # U Process
5
#+ "'"
File System
/
Y '6 @ E4 Client ' %9 #
' #+/'/ # User Interface S$" +
#+ 1%E Server H"
TCP - .
/
H"
+ B ' Server PI TCP Command
^ "' - # / User PI 0 t &
# User DTP t &
#+ Server 7 ' - o/ [ / Client 7 ' - / / ) 5 Control Connection
G<= 5 # / TCP 5 6 0
H" #+ "
1"2 Q*
Q[G %Q @ Server DTP 0 ,
$ %/ 1"2v ': "1"2 w # / File System
Y #0'K" $E '6 @ $" % *Data Connection
+ Client
FTP

FTP Client

H% +

H"
+
J" Client ' %9 #0 Y TCP 7 ' - Client ' %9 # / :
Control 6
H" #+ / . '# D )-i
/ : User Interface - . / ' # + . / Telnet )* +Q, '[
/
/ %/ : ' I* 1"2 #+ 5 # #' Server U File System ' # # + .-Y <@ *
6 - . / ) K ' #8 + '5' Data 6 Upload Download )K " * D * + Download
'#
Server
)-i 0 ' [ . '#)= @ Server
: c "'/ 3 *p : 0 Command H% '2 /
# + K . /'2
! " #+ Client
J" ) 5 Server / . GUpload Download 0 ' N%4
+ VO5Data
H" c 9/ 2'( D @=
+ '5' 5
Data

219

FTP /

/ - + >u 4
/
/
+" o / [ /
/ /
Client
O*
%%+ 8 #+ J" Server #
. x% a
#
0
Command .
'# # E4
ASCII H% ' 2+ %QK* y N 7 '
+ . /
$%* +
#+* '2H% * +
*
0 QY # / USER '2$%# . /
' K"
'2 / . v ' #) * G
'2
Password G0 QY # / Pass
/ . G' #
'2 / ' #c [
/
Y
' #)*FTP Server # + .-Y H" L : $/ .'
USER
+ .- Y
/ LIST '2 " * D * + ' # #0'K" '2 " *+ )= @
: .z X(N%*Pass '2
0 " 0
Y 0 1"2
2 " W * + 'K"
@ '%K
% Server +Q20 #'" - Client #
8 / Server - 1 "2 2" +
/ . Gretrieve 0 Q#- # RETR 0
/
% Server $ %/ 1"2
Client #
/ + H"
+ / Server 7 ' +Q"2)*0. = @ <i
/ HTTP Get
HTTP PUT
. 2'( store 0 Q#- # / STOR 0
'2 # Download 1"2H" / 1"
/
# Upload f Server - +Q"2 + ' # Command H"
/ /
OK ' #)*||k{ >
@ $%%+ Client 0
'2 Server 0 o/ [- +" > /
+&/ [ * + } / -%*
@ 0 Q# U
~ User
'2Server #+ K c [fCommand USER F Y
H
$/ # H"
+ ||k o/ [ C /
'2'( #+
O
G8 '# 2" ' #)*
+* +
/ . J" Data
#H" +
kr 'K" Command " /' Password ) Data Base
, J" Client Data Connection #. M*^ 2 Server # / + H" r o/ [ " + , 3 ' 1"2
/ . J" G + , . ^2 *1"2 P* %Q @ # / + H" r o/ [ "
> H"
# / 1, H" . W
Y . W ! "FTP Server FTP Client H% <i # + M*
%Q @H " ' %(+ o / [ /'2+ 0'K" Command < J 8 '%(+ o/ [ /'2+ Command ! "Client
# c "'/ 3 *Client 7 ' - STOR RETR /
/' Upload Download 0 OP* # + " +2'
#+ g &M / Q[G " Q*
'%(+
D P* %Q @
+ J" Data Connection

220

Mail Server

User Agent

"#

$ %
,
2 (Mail Server !

' % (Mail Server


+
! *
) SMTP
/ 01 &
e-mail .
!SMTP (User Agent
3
456( (Software (User Agent
( 1:
8 95
3
+ 7 Client
:
8= * 44 < 46 4 ;
4
44 :> 3<
@
' Mail Server ? '
3
(
3
8&
- ? ' 8! 4A
44% 3 ; Mail Box 2
/ Mail Server 4 5
User Agent F)
. "! 4 A +
B<3 C & ? DE
4( 3
3 ; Mail Box
( 1:
C4 ! 44
(
; , 5 G 6" $
( 3<# 3
1:
5
!Netscape Messenger Outlook Express 4
6 ".
;3
3< + 7
*
456( ( 1: (Mail Server
( 1:
! 4( , 5 G
(
H:E 8 ' I Mail Box ! 44
C Mail Box ; 3
* . "!
B
M 6".
56"N 4/ K LI)
;J C < 3
5:
G
4 @
Mail
* - ? '8!
;J
Mail Box 3
Server
Mail
@
(
4 " 5
(
3
;J Mail Box 3<8 O6 ,
F)
74M ! P ; 3
( :
@
1 , Mail Server 1: - ? ' 8 !
( ! Q/ : R ,
+ 43 8
*
)Q / 3
@ Mail Server
! * @
7I ? ' + 4 $ % C
"2, 5 G 6" 56 ,
7 4M
(
8&
@ :Mail Server (
SMTP
S > RFC 2821 SMTP
"! 4( ) 5;
44 C & 3 ;
(Mail) 56" ( 56 B<
" !
Server
SMTP
" Default T "! 4
95 Transport
TCP 8 SMTP
"! UV A
( @ Y , M X Handshaking W
E
@ :
5) SMTP
Z
:
4 @
Server Client
( "
"SMTP !$ % 5; Y ( 56
5
> (
1 B< Response [ "
@
5 Z ASCI Text T / (Command !
!
> M ' T \ > Status Code

221

&

GK e-mail .

4/

M -^

_ 5

Webmail.iust.ac.ir

5B ]
! 4

> M

Mail Server

(
!
(
Mail Server
Yahoo.com
3
4/ M -^ Mail Server
Account a 6E
User1
` :!
& User2
(
5^ User2
` : 4cA( user1@webmail.iust.ac.ir , 5 G 6"b <
: e& H dI 8 U A
5
) !user2@yahoo.com , 5 G 6"b <
Account C <
)
' % g ( - T %M 2f A
4cA( ! F) 3 B& 8 dI (
(Server
(
3
4/
M -^
C^ , @ K 3 4M
&
Account B<
Mail (
yahoo.com
Mail Server
(
5 Account 3
4/ M -^ Mail Server
` : . "!
( ;@ % U
f
8 mail @ I5 R >
)
)@ K
! - 3 - Server
5! A@ U
f
4
8=
3
4 Off Line T / f
/ % f
26
5 24
;
5;
) User Agent 8 95
8=
( :
5 @
E
. "! 6
U
b < Header
4 Attach
! 4@
User1
;
User Agent
E
! Off Line AM,
H4
E
U E
_ d C4 !
75 % f
> E
8
h E C4 ! Account 3< User1
Mail Server
E User1
4/
M -^
2
@ 3 8
-4(
*
)@ Q / , 3
"8 95
( Mail Server ! 4
I54 yahoo.com (
Mail Server
i E
SMTP
*
A7
;
8 User 2 !
@K V E
(
)U
Mail Box 3
/ % 2 4^
;
^"
yahoo.com
Mail Server
; User Agent 8 95
75
HEX ;
\9/
4
: j E
4
; Mail Box 2
3
;
3
5 & 5
!4
6
Account 3<
( Mail Server
44
! 4 A AM 7 I k %
d 3 4M
Mail Server
d 3 (Mail Server $ %
User1

; 5
5G
3<8
/ :#; ,
!
4<
,
B5
/ A6)
4< l O ! 3 "
dI #;
( :
Subject 2From 2To 4
Header

222

3
!

8= * ! 6 n 3<R >
C 2 < C 8
4 m O^
( :
56"
" T MX ' 5
% F)
!
"
& ( CC 4
B 3<3
4 8. "
/ (
A6)
ASCII
(5 T /
3<User Agent
23<
1:
G
!!! 5 , : * 2T / 4
95 1&
/ G <
! <
5T /
3<
H4
%)@ K
GK C4
8
@ I5 E
7 4M ! ( 3 ^
5
\
W
Sending 3 4M
\
4 Mail Server
!
4
Receiving Mail Server 3 4M
: 4
d A(
rms sms
UV A T " TCP Connection ,
C
handshaking T AM
T AM
! * T / rms sms
m O^
E
! * T / '
([ "
E
F)
F
A6 ) ! 8 "
8= 4 B&
MX ' @ % Mail Server
E
*
4 Quit 5 @
)
4 , 5G
56 @
) sms
B5
I54 A
A
! D " 3 "T AM rms ? ' 8 $ % Fd) %) :
& 5 F) . "
! 44
- A(
-n
rms
- sms
Mail Server
Mail Server

, 1 @ T AM Sms
6 I
a 6E Y yahoo.com

223

"

5
; sms
5
! 4 @
UV T " Connection
4
XM [ "@
rms .
4
) $ %
4
X M sms . !
yahoo.com
4
:
P ; 4
X
! 56( A
@
<
*
44 : Web Server 3<8
4
X
44 @ Web Server
! <
rms
sms 3<8
;
? '8
4
XM
f
3<
A
(;
; [ " Rms ! 4 @
rms C4
!4
XM
* sms
TCP

4
/ Data 3 :sms . ! 4 @
_ d
"2 4 "
/
E !
9 m O^ 2
< B4 #; ,
dI ,
53 " 4 :
56( <
C
F)
S>
/ @
) Sms 2Handshake 3 "8 !
Handshake $ %
8
4
3<!
) * Mail Box
:
* Rms 2 5 :
,
A @K
! ( 3 "3<
Fd) $ % UUf [ " ( rms
/ Quit 3 :sms )
!
4< (
3
4/ M -^ Mail Server
SMTP $ %
rms

MIME

C 3
W

l O (

4( S > 3 4M

95 MIME
9 &

MIME

. "!

(RFC 8
@ K 3 4M !

jpeg

5; , 5 G 6" ",
-4(
95O 01&
, 5 G 6" ",
8
95 MIME 5
- A( 4 # ;
F) !
#;
8
M>
\>
A @ # ; ! 44 m O^
(o
!
1.0
4 m O^ MIME l
8
5\
4 m O^
#;
base64 p 4
)header

7 R 8 5\
!
MIME

"3

\>

$ RFC

4 m O^
5: *
&

#;
8

$RFC % &

A& 8 !
> M MIME
8= T \ > 2077 2046 22045 (RFC
95O
rsubtype typeq
m O^ 5 "
5 , - T %M 4
3<
MIME
> M )MIME
(s
A& 8 !
(o ( 5 " A6)3<8
Content-Type: Type /Subtype
!4
;t ; B a
B
8
(!
Application 2Video 2Audio 2Image 2Text
Application
u mpeg, quicktime Video
u
gif, jpeg Image
u Plain, html Text
5 G , Q 5O (l O Content-Type *
+
!MSword, Octet-stream
95 v1&
5
!
; t ; Subtype Type

224

!
# #

"#

MIME

#
$ Content-Type
* +,
# %&! ' (
)
$ -./$+
# boundary
( 2 $ 3 01
) )
+ 01 ,
#
24 #
, header
5
) StartOfNextPart 3 01
$ 4 # 67
2
$
@ 1 "#
A 581 B$ =>?> <
</1 ;
&&1
: # # ( 8"! 9 0
* + ) # 2C ;
$ ,
D
)5.)
2$ StartOfNextPart 3 01 5 )
3 E+ 80D
2C
)
+1F G H.@ + )
# 2C MIME
#
) # @ 1 I+J 9 0
#
L
jpeg 4
5 2 I + # Encode K base 64 4
N
I+ )
#
8/# '
%&!
) # !
E
( .M
,
( B %&! , 4 #
) #
2$ StartOfNextPart 3 01 O ;
SQ
) R
( $. I + : ) )9 P
.M
( < )5 Text
W + 01 /. / ( , V 8 ( &! )5 # !
T .++
UN
ZApplication YVideo YAudio YImage YTextX #

#
#

E8 %&!

4 # A 3 01 %&! 2

# @ 1 MIME [ 7
)
\ 3 .A I ( %&! 2
J ^ F )5 # ! 5.) < 6 Web ( ]EA ,
HTTP ( < ,
, . / <N( , M
T 7 ( @ 1( ]
#
. _ Web Server -6< ( 2- R3 A 3 1F G Web ( ]EA ,
- R HTML a&. /
E
;
) +.` )^ G Web Server -6< 3 A 3 1F G
M ! Web ( ]EA , ( &! Ob U N
Web ( ]EA
.M
D52 ) %&! HTML \
@ 1 )
2
D52 )
%&!
) .N 8;+HTML - R ) 8 1 O. c ) 9
Y #
<
+ ) B2 , . / (
<. -/#
,. / ( ,
)
a "+ # 9
) D L
d /E
e ( 1 "; , B "2
R M D52 ) %&!
9
R^ G
.M^ G
# #LM
) 3 A Yf Y I +Y # 51 ( &!
#
Simple Mail Transfer Protocol

-/+ N

+ 2Mail Server . [ 0+ $."2

225

E - D[ 0+
bO " -/+ N
E
UN
W SMTP

2Mail Server . G 0+ R
2Mail Server
W
TG
(2

) )

B 2 .)
# Access

I]

-/+ N

) +.` ) . G 0+ -/+ N
Mail Server [ 0+ 4
Ob "

J! Mail Server

# . _ Mail Server
), Mail Box ) 2
+ a "<D
geF ) 8/# h 7 ) B
Access g
i]
) T+
fD J
) ; <! Mail Box
) 2-/+ N
# j 7 Access
W + 01 #
RM )
POP3

Post Office Protocol

Internet Mail Access Protocol

D E

Access

- /+ N

# # l (

AI

) HTTP -/+ N .k"2


.M
POP3

# E C S "8)
;
9
Client (
Server )
.NS
Server (
Client )
.NC )
) 9
- /+ Nh G Server Client . [ 0+
+ 01
( ] [ 0+ , POP3
m N
Client ^ G
Server
M Server ^ G Client ^ G + 01
%&! - # ]
#
2
)
) ) +.8"1 "
]
Authorization 9 %&!
Server ) ) , ") # 9
Server Client . ) +1F G 9
Z9 6 X transaction a
)
#
)
( 7
a D )a "<D
# o"7 Server
<Nn A Account !
3 ..p+X ) ^ Le
B J Y.
<2 n A
)
2- R 2 Y )
<Nn A
Z ) 9 "1 a b
M
a
)a
) aF 1
E
-/+ Na
M Server 9
M ;
2
+OK a .N9
a D <Nn A 0e A . a
! q . $+ U NServer (
;
) Password 9
a D Server ( 8e
2
_ a.N / .N a Server
( 8e Y 8e
#
# ) ) 2
$ +OK 9
)
Password
Server
;
# .
)
#
# # 9
OF r ) )
<Nn A
+ Client
# s R9 r
) 9
(
) <Nn A
! (2
<. m N Server List
M & )( 1
8A R
# ( LM "# T .++ 2
! ) <Nn A
)
2
$
T <e
- R
9
Client U N )
header , 9
a D Server <. ( J
226

FO r
+ Client )
;
) 2$
<Nn A
! (2
( I
<. YList 3 01
)
) .0 "
= ( "#
= "# (
- ) M
2 a; retr 1 9
.0
+ client ;
LM 9 a"+ (
N
"
9
a D Server .0
9
.0 ( ( &.
UN
( .M /
+
) " t7DServer
[ 0+ quit
"#
(
U N )9 r
) "d N
<Nn A
- )
2 Ydele
&.
.
) R
u "# (
"d N
Y= "#
&.
)d NServer
) t7DServer
[ 0+ quit
" 9 r )( 7 "2
,
E
"# )
&
M
(
.< -/+ NPOP3
. + &.'
( JN
"# # (
] [ 0+ ,
+ [ 0+
.) D [ 0+
Mail Server
# ] 3 .f&!
)9 r
1
] .< 2
D ) .
) + / POP3 9 e .1
)
<Nn A
a D +"
tD
state less
e
-/+ N, POP3 B ^ G
J J
.2 a; . + # #
) ( ] 3 .8"1 J + .)
E POP3 ) B 2 "#
0
! IMAP -/+ NPOP3 -/+ N- 6
IMAP

3 /

( + .B -/+ N

( JN

. g

+-I E .<

POP3

-/+ N

0<

-/+ N
0< ( $.

IMAP

IMAP

R ; - #

) 52 R
)(
<Nn A
/ -/+ N
#
R '
,
D B
R
R,
2
)e
5. )vEe 5 a; 80D( 2 <$ 9 G ) +.8"1 3 1F G + IMAP -/+ N E
a; w
Mail Box (
) ) + .8"1 ( 6
state less -/+ N, IMAP -/+ NtD
2 D ) .
/ vEe + 2
Domain Name System

# @ 1 Z2a ( X Domain Name System x RFC1034


#
R (
( 1 M
)( 7 "2 Y5 N
r DNS R ( Q <.' DNS
,
R,
#
#- 1 '(
.86+ 52 2 +.` )5.)
E - 1 '
0+ 8< 8 a a&. / , (
#
# M
a , a ,
+. 3 A
O 6 !
, (
+ q # 2 9 e .1 Y #
M
a a %&! - # a , ( q # 2 ) 5.<2
"# + q # 2
q # ( 2 $ \
AI
G
0.++,
) # 8 ( "#
- 1
+ + q # , )5 # !
UN # #
\ (
# ( "# 3 ` N
' 25 < .
# ( O 6 ( +.` )( 2 /0#
# 2y
#
#, . 3 A
E8
End
5. IP Address
)( "# 9 r 1 # "# R
a D
. ( 25 <. ' 2System
3 A 5 < . 2(
"#
y
M5 <. , ^ Y
. >u 1 , ^ (
(.
)
F 15 <. , ) # . .N .k"2 # 5 <. , ^
y
+
#
; R I]
"# 52
M
a a 52 4 " !
R, 5.EM )( 7 "2 # # 52 a , Y # # "# ,
227

25 < . ( a ! 0 a , 52
IP y
"# , ( 5 <. 2 52 ( +.` )( 2 /0#
8
# . .N( +.` )( 25 <. ( ) 2a # 52 a (
+ 5 <. , . T <e <. 3 @ ,
0+ 8<8 Y
)
#l
www.iust.ac.ir
A 581 B$ Web Server + .` )a OF r
8A a www t D www H7
b iust H7 Yac H7 Yir H7 # H7 J' 0+ 8<8 a ,
#
R , ' ) 5 -r
+.` )
/"
+.` ) -. Ra
;# b
iust.ac.ir
! ) . g
( 2 /0# < . 7 - "1 )5.) #
; Y # R) J + a ! IP y
/
( &!
2 y ( -"1 ( ]A ( +.` )
(
N5
) " E 5
<2 IP y
( +.` )( 2 /0#
)
OF "1 N )
#
EM " <. ,
DNS /0#
W %&! (
)
2 +.` )( a l
( LB 5 <. ,
+.` ) a +.` ) 2 IP y
. [ 0+ )
52 R /
) # t +(
B N,
M D
+.` )a <
+.` )a IP y
<
) ) )
D
/
[ 0+
!
) .N
IP y
9P
/" ) " E
. R [ 0+ ; ( a ( +.` )( /0# , # # ) 7 "2
W5.)
# &
; Q
& '( Q
<e ' ( ( LMa U N ) # ; 2_
5 81 B$
l a , MU N
y ( "# ( ` G
+e 5 ( ` G
)
+ # 2 vEe 2_ + e # R
A
.M D .
IP y
a&. / , 5 B 3 01
) ;
) R(
+F .J<+ 3 / ( LM5 a&. /
2y
)
2y
( LM5 a&. / , IP y
# l <] User Friendly )
) )
+ e /0#
System Friendly
.
+ .` )a <
) <. 5 ..p+ ( . ) ..p+5 <. , IP y
M
) #
)( 7 "2 W ) # 9 r ,
+ ;
Q
) ..p+IP y
.
)
( "# E8+( "# 2
E8+( "# (
E8+
2 .
unique 3 A
Y ) q $
J#
, Y $) )
,
A
2 # l
,+
"# M
E8+ \ ( "# tD 52
,
) q $
J# .e
,
J#
( 8] "# M ) @ 1 A ( "# "#
# J+ J#
E8+ T e A
.)s 1
J# M Y 2 ( ! ( "# "#
# s 1 "# ( "# O 0! .) s 1 J+
B N,
5
52 a ,
"#
F 1 E8+ 2
E8+( /0#
M 9 e -/# ."2
M - ] "# M )5 ) .N /
Y ) ; [ 0+ "# a . T
(
) l
E8+ ( "# )
) ;
# s 1 "# E8+ "#
) s 1
tD
# ) "#
2
) 0 E8+( "# ..p+aF 1 (
4F G ( . ) " ..p+
a
! tD U N ) .N
"#
< + E8+ .8)( ]EA (
"# a
)
a /
M ..p+w
IP y
) ) ;
/
+ .` ), (
&"2 IP y
+ !
+
)
E a
) B2
) ) ..p+
5 < . h G IP y
) .N
DNS

228

D9 r

$.

#
)v Ee
.M
)5.2
O

2_

( /0#

e
A a JE 3 1F G

( LM5 a

.A
www.iust.ac.ir 5. M
# V 8 ( J "<D
N5.2

DNS Component DNS

..+-/# ' 5 ,
#

) )

RM )

#Y) 5

# W( LM5 ( z R
# register
)
eF 7A Zone

( # t +(
BN
6 - ] 2Name Server
E8 4 2Name Server ) K Name Server DNS Server
BN
a ; IP y
5
5
IP y
- 0+3 .8"1 2Name Server <2 # t +(
2
DNS Resolver y
- 0+a&. /
2DNS Server 2 +.` ) . G 0+ -/+ N
5 N J
5.)
# DNS 5 <.
8A %&! { T .++
/ # EM )( 7 "2
5 )5.# # ! +
Domain Name Space a ( z RDNS ( &!
# fD M
* '
0+ 8<8
0+ 8<8
, ( ( +.` )( 2 /0#
#LM 76 2 -./$+ H7 ,
)5 %&! , 2 . )
) e H7
+b H7
+ .N
) ! B "2 %&! 76
#
DNS

$ % &' (

"#

a ) +.` ), ( LMa [ 0+ -/#


( z R- )
# Webmail.iust.ac.ir
%& ! ' (
+ .` ) 5.. ( LM5
" 5
M Y#
5
-/ #
%& ! 5. ) B * ' "
" .e
) f&! 5.2 q . $+
)
76 ,
D5 ( J
jF 7A
" # M 5. M Root Domain
[ 0+ -/#
Root Y .) B
D
( .e
+b Domain
a %&!
.. Y .) ! +
[ 0+ M 5. M Top Level Domain
jF 7A
)
ir 5
)
First Level Domain KTop Level Domain
3 D 2M
DTop Level Domain
' Root Domain
DH7
)
8"!
#
EM52
)
ac + .` )
5 a %&! <2 org, edu, com,
ir H7
) .. . E ! +
. [ 0+
M # Secondary Level Domain tD
j 7 E8 j 7
EM Subdomain
OeF 7A )
iust + .` )
5
( %&! ac H7 8"!
/ ) #
2$
-/#
#
5 V 8 %&! T .++
U N # iust x ac ( 2 #
229

) Webmail a
# tD * ' " . J
) f&!
( /0# ( LM5 ( z R )5 # !
9r
UN
) E
+ + .` ), ( LMa (
#
#
. Fully Qualified Domain Name jF 7A

230

%&!
5. +5 ) geF
+.` )
R, ' )5
+ .` ) 5 tD
# ..+ .N OF )
, (
#
; +.` ), ( -/#
)

'

Structure

$ %&

!" #

0123 45 64 4 Host name . / '- $ Sub domain $ +, ") *2nd Level ") *1st Level ") * +, ' 'B1+4 4 ;<4= " %5 5 @A >5 "? " 10
# 6 ;<= # $" " 10 - %5 5 9:: 82 6 5 1
#7
6
" 1=1
H
#Sob Domain " 10 Sub domain ") EF$ G 'C2 ' $"D
' "
K 5'
C I *C I
" 5 '2J) ICANN C I #
" Register $
"5 ' "
"5
L 2 ""= #Top Level Name $! 5
#Top Level Name
64 ! U% 1
5 2 T
$" 5 'MN
5 O 10 !" P Q%
R &S $
"5
"2 V "
R&
$"4 4 ir 4#Top Level Name
EF$ W > 1) *' !" E 10 S $ (
ICANN 5 S $
4 42 #8#$Y <5 Z ? W ? 5
' ! 5
$
R&
ir '2J1XC ICANN
\ ( <2 -#
` 2 #8#$Y <5 _ 7$^ " 10
' !" ir ] Top Level J1% ' [
$ "45 4 ac, com,
ir ") Level " 10
ab > " - 2\ 0 1& 2%&
ir ") %&
"4 10 ab > " 5
$
d C I ;<= #
%&
'2J1XC " 10
2c-#
"4 10 4 ac.ir J14%
4 `ac.ir 614THd $ab >^ " 5
$
61THd $ ac.ir
4 ')4R $ 4TH ! 4 & 4 ( 4 1H " 5 22)0 1& ;<=
")
%&
4 &4
4 ' " " 10 W ? 2H $"# e f %& $ tu.ac.ir
L0 !
$ iust.ac.ir
b> " $_ T%Q L#
iust "4 $'4 !"4
$
')R $ TH !
iust ' " a
$ Computer Engineering^ ee $ ce ab >4 "45 14& e 4& 4#Sob Domain 4 4 6"4F " 10 1&
' !" E 10 ' " ( #
' " 5 1
=1% G
$ `Electrical Engineering
TOP Level Domains

! 4 #Top Level Domain %C2J


W$ 41
"4
1 $ L V$ 25
4 ! 4 $'44 $ ac *edu *com 4 45
4 ! 4 45 6$ !$ $
e & # '2J)
4>
e & 2 g= #'2)F1 $ # 1 5
Top 'C42J eu 4$
D0 *nl " T# *ir
" 5 )J+ J # ICANN Level Domain
$"4 <U2 'C2J
5 ' "R ah1-) $

231

"4"= #Top Level Domain 2 i C?


"5
E4F$ "25 )= http://www.icann.org/tlds j V "2 10 #Top Level Domain '2)Z$ &V $V' "
!"# 4 V
4#Top Level Domain 4&V 45 ICANN '
Q " 5 ! Top Level Domain System
&V "25
' $
D0
5 1 eu 5
ICANN 5 Top Level Domain
Zone

4 $' DNS %C2 ( ;<= 2$ Zone


4Q 25 ! U%
,
V )
!"4 4 4
#6 %& k M0 %&
4 ! $"4D (
%&
8Q # $'
( 4 4# Zone 4# 4 $ 45 1f0 Zone
Data (
$? 5 0123 5 Name Server
F' R & Base
(4
4 64
4
4Q # Zone 6<2
' !" P Q% Zone 6<2 DNS %C2 0'? ' "
" 10 - 0123 5 (
d MH
2
FZone (
' 6
5 0123 5 # ' ! 5 '
Zone
45 "25 1f 0 "2 10 G " M Zone $ 5 " 1=$ 0123 5 l2#
m n $ 2 FZone ( 82
5
6-0
-4 l2#
m n $" " Overlap $ % # $ 5 " !" 2C,0 # 2? " 1=$ 2
6"5 # " # 2?
o & 5 " 1=$
Name ( Zone #
G3 $1
%U Zone ( # 2?
Server
d 4Hb n '4 d 4MH Zone # d Hb n ' Zone Vd Hbn $? Name Server
5 ' !"
DNS d 42T-H _ 4F10
2 1T=
5 2 % =10 %MJ`Zone V # 0123 5 d fQ $ Zone V6 *IP j V
( 4 4 & d 1R
5 "5
5 ' 1& M2% 0123 5 Back up (
Name Server #
1 _ F1% $ $ 2 " 5
# Name Server V 5 C $ Name Server
Zone Data Base File

Record

4# 15
4 $'
1 ! 2&p Zone VName Server k1 Databse Zone # d Hb n
RR ( '
"
Resource Records "1
! 2&p #Data Base
$ 5 0 Hb n
Data Base
4 ab >4 '4 RR r1 !" 5q Q * TR ;<= 1H Type ] `Value $ Type *Class *TTL *Name^ ' d MH
Type 4
1&
0123 5 ( IP j V$6 k1 d Hbn RR ( 5 '
!" #
" Type = A
4 CNAME "4 10 4 Type
Zone s Name Server j V 4 ! 4 RR ( 4 5 '
!" #
" = NS
"45 4 4 0123 5 ( Nickname $ TR
2 n M0 RR " Type = CNAME " Canonical Name
4 4 4# 15
5 )%C
$" % TR
( " 10 0123 5 ( 5 1
=1% EF$ G
'
!" #
" Type = MX $" MX " 10 Type 1
# 7 )%C
$ TR
k M0 CNAME
Mail Server (
" 5 ! RR ( 5
Zone

Type

9t $44? Database ( 44
44Q 44
!"4 V 4 4 W$ 15 tt 5 ' 15
232

$" A . 0
5 22 W$ 15
'
!"# 4 '4 '-4 1% <2 VW > %MJ
!"4#
RR
$ A 1=$$ 1
] IP j V 24 k 4M0 145 4 5 '
G 4 '4 ! 45 F www
10.1.1.1
"4# 1& 6 !" #
RR $ Name 8Q
!"44#
44 RR $ Value 844Q $ 144
1 "# 1& IP j V
i 20 0
A. 0
RR e & r1 (
14=$ 145 '4 4 - 245
4
J4> "4 NS V. 4 0 45 " %
2/ 1=$ 22 9 ! - 15
15
$44? 1445 4 45
4 ! 4 3 40
' Name Server ( d Hb n
4 14n 4 2-# $" %C# #Zone #Name Server 5 2 Authoritative Name Server Name Server
$' !" Vna.av.com 6
Name Server 6 W >
" 1& $ Zone V # 0123 5 k1 d Hb n
4 ab >4
4 4 "/
1 v2Z10 u1 1 2 ' !" Vu1 W$"=
- L3 0 r1 i 20 0 2-#
Host
d MH
1 ! Host 1
0 D2Z10 Value 8Q *W$"= tA ! - 15 " " HINFO . 0
w 4D 2- 0 "
Solaris
H %C2
Host 0123 5 5 '
2W >
1
Z H Information
1 !
# Class $ TTL #8Q ' 6 h RR
Zone

Class TTL

4&

1445 4# 4-H !"44#


4 TTL
5 $ ( 1D ! U% *' Database
4&
4 d 14R 4 15
5
45 4 4 14
"L Database
( 4 1D %-5 1
% 1 TTL "T2 &
4 145 4 45 "45 q Q *" $
V
5 $"D d "
' !" "2FTTL
45 V ") $"
F Database &
1
%
! U%4 DNS 6<2 4
4 '4 ' %
M ) $ 1 "# 1& 15 # j b5 IN ah1-) 5
Class ;<=
j b 45 " 4 %4 ' % k M0 5
$" f Q
L% % $ f Q e & # M
25
IN 4
2#
F
1& e & j b 5 $ 25 - _ )0

233

Zone

'4 15 x
IN j b45 *'4

Database

!"

[ +
W$ 15
HINFO . 4 0
mail.iust.ac.ir V 4 '4
4 1D VTTL $
i 20 0
$ ' Sun Unix VValue $'
6444 44 0123 445 445 1444 44 44=1%
$ Sun r144 Hardware
mail.iust.ac.ir
' Unix r1 T H %C2
%
F 15
$ 0123 5
1
0 Hb n
d MH
d 1R d Hb n
5 ) 1D
TTL '
A . 4 0 "4) 145 '4
4R$' %
M
0123 5
) # IN j b 5 $"
F Database $
5 "#
j V
mail.iust.ac.ir 0123 45 4 d 4MH
1&
0123 5 ( IP j V$6 15
O4& 4 14=$ 4 $' A . 0 <2 ") O& ' !" q Q TTL 1D $ IN j b5 a"
<2 130.37.16.112
=1%
j V$
mail.iust.ac.ir 0123 45 W 4>
ab > " % IP j V" / " 10 0123 5 ( 5 1
W ) j V$
2 i C? $" 2 - F! U% 1 <-# 1n j V$
5'
=10 " $' IP
d MH
"
4Fy b4 W$ 15 "% *" 5
F j V$6 2 k M0 5
# DNS %C2
0123 5 5 '
)
$' MX r1 . 0 61 15 5 "# 1& 6b H # 6$ 15 2 d 1R $"#
V
5
$ E4F$ 1
\?b 5 1+ -# Mail Server $' mail Server ( ' !" V 8Q
4J$ 4 45 4 0123 45 $ ab 4-HG 4 '4 !"
Secondary Mail Server $ Primary Mail Server 0123 5
14/ " 5 '2J) mail.iust.ac.ir T5 6 'D0 0123 5 $ # 5 ' ms.iust.ac.ir $
$ mail.iust.ac.ir
MF 15 $ *' !" 282 0123 5 $
'4 !"4 %4 mail.iust.ac.ir 42%&
4# IP j V$
42-# #Server
G ' G $ m ?
2 1T= 1\
#Server
Secondary $ Primary 1=$
1H
$' 5 W ?
G $ 4 *14 4
4 4/ Primary G $ 4 45 %J4? O4, $'4 W ) $
4F k 4M0 )%C4 $ 4)F$ 4 24 45 " %C# CNAME r1
") 15 $ 2
F! U% 1 Secondary
0123 5 5
! W$ O& " 5
$'4 post.iust.ac.ir 6
Nickname
mail.iust.ac.ir TR 6
"
0123 5
ftp.iust.ac.ir
Nickname
file.iust.ac.ir TR 6
Database

DNS

`Name 4 IP Address "4M0^ DNS d 42T-H ! 4= 4R & # < 6 W1MF 5 " %C# # $ DNS # $
5
6
w D ( 10
"#
4 < 4/ 4 $d b
/ 2 ! U% Server (
"4/ W 4? 24H
4J$*"4
"2U
5 $ $ "L \ +, TC "F Server ( ! U% 1
"=
m n $ $ Server ( m n 2
DNS d 2T-H ( 2 0 6-0 " 5
DNS d 42T-H
?'
- 0 L -# $ 1 E+FDNS G $
1 o & 5 T2J # Server
=10 " 1 1= " 1% 0123 5 ( 5 "
"?
$" ")% DNS #Server 5 !" % 2-f 0 *w D
4 ! U%4 !" E 10 6<2 (
E4F$ 4#Server 4
14=$ DNS Server - 42 "4)0 42 4
5 " %C# # 0123 5
10 # < 6
T-= *' !" i f V DNS Server < 6 r1 ( m n (
DNS 4 k14 Database
4Q 4 m n $ 5 ! ' T5 !
[ T)% R
5 BIND < 6

234

6"F ' !" V 0123 5 Database

Data

Zone

! $"D

' _ 71 0123 5 # ' 0123 5


2%&
" G H $ Name IP Address "M0
DNS Server ) * '( #$% $ & '(

k M0
( ! U%
10
2 h
, 1LU
4 !"4 ! 4 h 4 '-C4F
2
\
#$
4 ")0 # $
5 DNS
45 "
R & _ 7$$ 2
' 0 tA
0 2 '-CF
'&
2# 1& V ")
#DNS Server W > 1H 25 !
%4 210
#DNS Server 0 2 v+ (
$
"1
%& edu
"1
%& com 5
d Hb n
Q ( W > 1H 5 2
# $ 4 $ # 0123 5 d Hb n EF$ 5 ac.ir > "
ir
5'
iust.ac.ir 45 Name Server a
b > $ 0 2 ", ( 5 2 10
$1
%& ac.ir LV
5 2 % 2 10
"# G $
LV
5 #Server 2T5
6 h Database s Name Server
DNS
24 4M0 TC4T k 4M0 ( 4 14=$
4
" % S 1& & " 10
1
%& iust.ac.ir
4#Zone ] DNS Server - 42 "4)0 r14$"4# G $ Zone ( DNS Server # 5 ' #Server
2T5 $" # G $
")%
84 1 '4 W 4) $!"4 _ 4 )0 '4 %
45
#Domain Name $
"#

235

236

Domain Name ir

!"#
&ac.ir %
Zone /

Domain Name ir

Domain Name ir

$
!' () * !+, * -Extension
ac.ir *
.
edu.ir &com.ir
0 1 ! ')2#
Name Server 3
Zone - *
'4 '
5
6 Name Server . 0 1 !
',$
$ 8
Zone * - # '7
9 :;
Backup 3 Name Server
Primary Zone name Server ; Name Server
&!

? @
! ,)- +AName Server - ,=> ! < Secondary Zone Name Server
Name Server
# ;
!
1 '> Name Server *
$ DNS * -request !, !" ',$
B"@ - IP
!
1
"EName Server *
DNS 0 1 $
# '7 &! =" CD1 '> - '> Name Server
G
:;
5
6 Name Server 3 !
,H< * :" I- &Authoritative Name Server F"
- !
* !BC" K 6
5 6.
,H< Zone @
0 ", * = Domain JD
1 * ''L#
-Name Server . Database * ,1 5 ; ''L# . &
Zone * - # '7 IP ? @
M2,
N
'1
Zone . Authoritative Name Server F " % : ;
-Name Server .
O $ M$ ! Update K 6
Zone 3 5
6 0 1 *Name Server 3 Authoritative Name Server
!
* !BC"
Name Server

R D

&-

1 P +, B"@Q=>
G Name Server *
B,'>S)
0 1 Name Server 3 3 > G ,

!+#

! G,!
H'; # G #
#
! ,)- H,D * B,
Name Server

Name Server

5 X FI#

Database

C"VupdateU

T#

Name Server

3
F "N

237

Name Server

AW
1.

8 Zone 5 6
!- ''L# '"5 ;

! %+:XName Server 3 3 >


!
X Name Server N 1
Authorization
Name Server 3
0 0X !
5 ;
0 ) '"* '"&0 1 Name Server Zone
Y'A
- ! " # QX
'C XZone @
# '7 3 C Z 6 ! 2,) = * :2"
Zone . ! [ S) !" #
Name Server 3
C 5 = !
@ ! " # Name Server 3

LJ

]/ " 0 '+X M
!
X. b
-Name Server .

!-! G O $
Zone ! [ Database !
! -Zone @* - N 1
<3
P : !" ! * \<F"Root Name Server F" -Name Server
# a & @` $ B"@* # ]_ &!" ! ^ DJ - =H>Z
Name Server
,J'
@* 0 )'". I 0 ", * = DNS 5 'I -Root Name Server . G
'
*C M
Root Server

,1

'
>!G
c[ <
^ DJ G # A * - 1
F "F
,1 '
C" 1 . 0 1
! ' 0 X < 0 1 ! @Name Server 3 >
! ,) - B,
- #
d + !''
# 2'2e# C Y
- $ B-CJ" $
( 1 # Root Name Server B % ! ,) !
CJ"
5 ( 1#G
F 1 ,1
,
@f A
0 1 ! !'X -Name Server " 0 '+X
!
,$ 0 > 1 B 1 QX
% QX d + 0 1
! ' C" < C
:2"g ! !'X
" 0 '+X
!''
@` $
Name Server . %h DJ N 0 1
0 1 Name Server # g Y'A 6
!
M
i ,1 R $ FY'" 3
!
0 1 IP ? @3 *
* :2"g
0 1 # '7 g I 6
0 1 ! T h"j ,D
<
` $
$
4D . *
# H, j ,D * -Me
!'' !' C"F
J ".
2 A@
$
X k G * '1@ - $ & M "' $ $ &
$ &! ,)@
0 1 . * !j ,D 8 2"
0 1 # '7 . ! [ % I
^ DJ IP ? @3
Name Server .
'"
I B
%
$
!
W
-Root Name Server . IP Address !+ ,1 0 1 ! !
!''
0 1 0 I1 ,1
,1 . $@ l 4
*
g4
*
&0 1 ! !'XIP ? @ # %
B ') Mh A
0 =)" =
JD
') " :2" ! . 0 1
ASN
'- $
,J'
.
Autonomous System Number

0 ", * = M
2,1 Routing

'

. 0 1 F m ASN A + *
') * -FY'" 0 I)X nYG 238

'

ASN

I . * h ,D A +
')2# YG
- ') " :2"

3
M

[ 7 0 ", * = M
*G @
!
Y'"
ASN N
$ R $ C[ 7
! ' h # !'" # I N
^ DJ I 3
= ! = . ![& ! =
I 3 - = . F! 1
- =
<3
,[ *- =
')2# 0 ", * =
R h,$
!"'C 'Ih # ! " # &!"
2,1
$
') Routing 8 =# * B- <.
< $ * B- <. F! - C Z 6
!
[
') * - , C> !
H,1
') FY'" [
Gate f "3 QX
; $ * -k ') P 6
J6 =# . !
, 8 =# - ! - D < Autonomous
X ! ,)- Way
Resolver

1.
Query .

!-

',$
) 1 0 1 * YAF "3
0 1 D1 -Name Server

,)'1 nYG
-Name Server
Z 6 Query 0 1 $ 1 M
!
&! - 0 1 $
* B,>
!'
% :;
0 > .
Resolver
M
,H< Forward Look Up Query
o A 01 M .
. * YG
3
@F" * # '7 0 J *
hD
'
0 1M
0 1 ,)J" ', \< Requesting Host
. N
M; www.icann.org F" *Server
8
URL Bar 4 D
Server . F" !,
J A Enter
c # O $ Web Browser
JA !+ !,) '1 0 1 Enter * I
+A
# '7
DNS
F "
-0 '>+A* ,
',$
! ' www.icann.org 6
1 p IP ? @ 0 1 Z !- .
3
1 ]*
!" $ I T '# #
!
^ DJ
lM
'C XRequesting host # '7
CJ" Name Server
' o A < 0 1 Local Name Server 3
Requesting host 0 1 $
query
X
0 +;
0+ ;
CJ " * =
- # '7 * ' 0 1 dns.iust.ac.ir @ 1
M $ ? @.
,1 5 ; C 5 =
!"
$ M$ VName Server . IP ? @U ? @. ! ,)- # '7
',$
! ' 0 1! ? @. - 3 '# # 5 ;
G
. ,=> 0 1 ! Set - # '7
.'> N
X
q1 3
^ DJ q * I
@
0 1 Query N G 0 1 ] * I
? @&0 1 ^ DJ " Server F"r 0 1 5 = q1 .
Local Name Server Requesting host
<
Server . IP ? @Local Name Server XH# 6
G 0>
s!
W 2# @IP
:
general 0 >
%m I+ >
F " Address Resolving MI Query 3 (2A < Answer !
q1 .'I- F *
' Local Name Server \> !" ? @. Local Name Server 0 1 M .
? @ 0 1 * 1 Root Name Server !
-Root Name Server # ]/
* !,1 A
Query
.'I- Root Name Server F 1 *
\ >0 1
*G $
'" * -Authoritative Name Server FI# IP
q1
.
0 1 &!
1 0 )- icann.org t Domain
* # '7 Authoritative Name Server *
239

Resolver

01

DNS

! + \ >!

,
Icann.org t Domain
G * - # '7 5 6 ! %+:X0 )- Authoritative [ # '7
.
.
Query .
!- u1 g *
&!'1 @ F 1 *
Root Name Server t Query
Local Z 6
k G .'I- ? @.
@0 1! !+ Root Name Server 0 1 ,HB" @
" IP ? @u1
3
!" < Requesting host k G . l *
Local Name Server !,1 A Name Server
0 1 ! @u1 3
,A Query 3
+ ! F " DNS Resolving
Web 5 'I !-! F " www.icann.org # '7
h# 5 'I
!- $ XRequesting host !+
Browsing
! < Forward Lookup Query 3 @ %m I+
> . ! f
Intermediate Name Server

!' 1 * M
P : 5 X - <
- "' * - 1 Authoritative Name Server
'4 ' "' 1 3 G .
!" G
t Root Name Server C 5 = 0 1 !
.
!
M2,
@0 1
Query
1
0 1 "' 1 .
"' 1
5
6
'< ? I# ; Authoritative
0 1 B,>
-. !
0A
* - 1 B, %
01 . I
!
H,1 O . v Y
!
,$ 1 * ! +, * -Zone 0 1 . I
,+1
<Y 0
! 'C " IBM M , %
1 3 ! , ! ' Z 6 @ Query 3 < N !
+AIBM * !+, * -Authoritative Name Server Q=:>
. P =6
!
!' 1 ,1 ! ,)- -Authoritative !+
XIntermediate Name Server "'
[
o A :
#
? I# DNS org t Name Server ! , Root \ >
XOrg *
icann.org
'<
!
M2, Query . DNS org !+
XRoot #.' w:1 3
0 1 *Name Server QX
!- u1 q1 . DNS icann.org "@ 0 1 Icann.org O $ * - $
!"# !
w'W # I *
# 'I
M
.
'C $ - * C 0 >
3
J"R
Referral F" R $ *
M
.
'- D < 0 1 !
!-J
A ,$ & ' ) 2 M=XM
Root Name Server ,A 0 1 8
* ' " %I'2,) O $ M =X0 >
> 0 A<
XAnswer Query
N
'< I" X ' " . Name Server
,X
Root Name
Query pa *
Server
Root Name Server &!1

240

$ !
. Local Name Server DNS.org ? @., \< ',$
/*
% :; ! ,
G ,'+W .'[ < ! 0 A
u1 !+ !
q1 DNS org '2,) !" , Server
Local Name Server *
. Root Name Server &Iterated Query Iterated Query ' < 0 '+W .
!
.)
u1 0 1 $ * ' " Intermediate Name Server Authoritative Name Serve
,I
Root Name Sever *
*
,A < ,I Root Name Server 0 X 0 1 . O .
@
=X0 >
!- $
Root Name
*
Recursive Query ! < Recursive Query
0 1 $ 3
# 6 !" #
- Root Name Sever
0 Y . B," > !
M'Ie# Sever
Local Name Server !
,>
0 1 x F m ! , O $ VAnswerU u1 VQueryU
C" @Answer Query 5 6 0 X 6 N !
Answer Query y 3 5
6
Cache F!X
z" [
Iterated
Recursive * ' " C !
1 Local Name Sever 3
B J Query
! Query @* CD1 !" # Local Name Sever $ !" Y>
! !' * ,J' I !" # Iterated FY'"
M .
!- Referral t Root .
* ' " O $ - Intermediate t Intermediate
!Referral
'< I" XAnswer Query
,'+W
t Authoritative Name Server
Z 6
!
1 3 'A #
'
!'4 - M .
- Intermediate Name Server
!
Local Name

! K T >: ,B ` *
! o A
' C"M
H,1 ', \< Client @ 1 * # '7
!
Requesting host C 5 =
Server
! ^ DJ Client * I
3
www.icann.org - Client . * X
3
* ;
X C * :2"
I !
* 4 2"Forward Lookup Query
h .'> ! '' M .
Local 3
&0 1 Name Server
*!+ h ! ,1 A
*
$ Query
q1 Zone 3 * - # '7
0 1 * 1 Local Name Server
Authoritative t IP ? @
f 6
0 1 * 1 Root Name Server &0 1 Root Name Server ! @ * #
241

,A < X @M$

0 1 *Zone pAuthoritative Name Server *!+ h &-Name Server


G , ' C" h # .
< 01
Local Name Server *
>q1 Query 3 T >X Client !,
Local Z 6 0 1 $ . t www.icann.org 0 1 IP ? @0 1 $
0 1 5 = q1 . F BH !,1 A
Name Server
6 ZonepAuthoritative Name Server *
0 1 $ .
- Root
Root Z 6
< !
* ') .'I- u1 . &u1
!+ !,1 A
Client
0 1 0 '+ W .
Client
< Web Server .
Browse 8 =#
% I !" # m
!' !h 2 IP? @
www.icann.org

242

API
$#$%

!"
Networking
API
API
Communication '($ $)! *$
+ $,-. /0 ) 12&
Function Socket
& Sockets
!) # 2
5 Application 6 + 3 4 5
Datagram 9Client Socket 9Connection Socket 9Server Socket !
! 5 7 5
8
Function Socket
Socket
$ Function $ $ !$5 ; " )
: Send, Read, Write, Close, Accept &
Socket
93 $ ?$."93 $ $@ > $ $ Function > ) )
) 12&
< = ) Function
!C
! &@ !
A B
* A B > )( 9A
2
Remote Procedure Call
B $ $ $5 $E !$ '!$ Call F +G H I "
5 J K ( Application 3 RPC ! ' ) DE& RPC
,9 5 Call L + 9 + B
)! ) @ >
Call
)!++ !+)
Software
$ $+ C2 $ $) ( !C ! )
2
G< +
, 5 A C2'!5 Call + 9 5 M , + >N
Q $= $) $ $ !$C $ RS >N( G<
! E
G<
G< O P 9
=Q =
'!5 ' 8 & %8 + ( 5 A TU
G$< $
) 20 = % Remote Procedure Call
W $, ! A
L!
5 J K ( )!
" +V )
7= G ! *+ +V )B
'!5 Call
5
+V )
12& X )
@ ) !
Remote Call ( ' 8 $ $ ! $5 $ Run '!5
Y! 5 5 3
L!
!
$ B $ ?$"
$5 $ $5 Socket Programming M $ /
)
12& RPC )!+5 5
$ RPC $) + $8
'!5 @ '!5 ' Socket Programming )
6 -. Extension
=
$ > $Z A O
#+ 'L >N 7 H # *+ OS ! ( ! #
2 ! * Format 3
$5 $ A $C2RPC $) L 9! ) ' 8 Format B ( ! *+ 7 H # *+ B
'! 5 Call '! ) Call
[
27 ! =
# $2 RPC >!$5 $G H > $ Wire Format #$ $ $%8 ! @ ) !5
X )7 5
5 ! =
' +@ ( L F H ! ' )
Call F $+G H
Q =F
'! ) Call
,9! &@ ) ( 7 " Q = > )
Call $L F $H $ W $, !$ &@
Client to Wire Format &
! N '! )
Wire Format #$ $ 1$+Z Q =
2( #
27 ! B
!
&@ RPC Call
+V ) !
F H0 K
!
&@
! 5 A C2Software >N ) ( 7 " '!5 Call ) Software )
9 $5 $
$) $ !$
'!5 Call 12& I +
5 &@ ! Wire to Server Format 7 ! F +G H
,!
$ =
> ,Q = ) '!5 '!+ Server @ )'!5 Call 12& ) ( !C 9 5
P
!$ = Server to Wire ( $ 27 !$
)#
27 !
B ' ( ! E '! ) Call
G! !
G<
A ) ) L
?$" W $, +E F < Wire Format to Client Format &
Server +$5
1$2& Client +5
12& )! ) @ >
Wire Format &1+
RPC
$ API )
! )' 8 ! * 7 ) Platform OS ( Server Client ! ) " 3
!!
$R $ !$ ) $ 7 H Object +5 ?"
Component #+
Components API
!
! $ ?"
6 S
B $ Common Object Request Brocker Architecture F $ G)( $) CORBA 7$\
C
!
!$
$@ F 6 $S $ !$) $ *$+ Networking F $+G H ) Component
$"> *$ $
$+=
&(6 $ Component $H @ $)! * 6 S G ( DCOM, COM+, COM
243

$ > ) )#G* !" ! N


$ > $) $)( $ $O $G+= RPC $ >
F $ )> Z 6 G+= *
3 $ ( U$+ F +;1
*S K
J K ( 12& + 3
+ C2

5 S
@ >
Component
$) ) ) . 9 RPC > ) )(
.C F !"#+) ) Socket
" L
#+ @ % O &*"
#+
O
(^ ] #+) ' 8 Component ( " 7

(' 8
%N !
O G+= Component
K(
Socket
! * low Level /0 )
] #+)#+R
5
5 #+ _ 5

Socket Programming
Socket Programming
= ,^ _
( !
Socket Programming

H @ I " & %8
!5 [ H Unix 7 H# *+ >
Berkeley 'LU
Socket API & %8 `ab` A
12&
3 $ #$ $ $ Function $ +E
Application )
'( !5 [ H 12&
Function
@
! ) " A
! 5
$ #$ A $ $@ ( !$C '!5 '! Client/Server & %8 # Function A
@ >
?$." 3
# Data A ( !C ! ) Data A
&!" Unreliable Reliable F < )!5
! )
$ $L TCP ( ' 8
X ! ) #+*] ^ _
[ /6 C Socket Programming
! '!%H Transportation 7] 7 O UDP TCP 7 , ) '!5 ' 5 /0 "YUDP ( ' 8
c $. 7 $5 ) ;1 !+)
7 5
$ $) !$++
# *+ !++
! '!5
%N( &!)
$) ! $5 Server Client !
*" ! G
5
Process 6
1$2& $ ( $
H @ Process ) #
$ 7$$ ,( $
2$[ $ Application
6
Application
5 A C2 " H @
5 = += 7 ) K /6 C Process
(
Process B # *+ B
E !
)
Z )
' ) +^ +, !+% Z Software Developer '! * )
I+ +
! $5 4 # ! _ Process
E L
+V )B
!5 5
Process !
( ' 8$
Process (
)
7 5
! 2 d 8 ) +G H9! 5 5 Inter Process Communication
$ #$ ! $] TCP ! $] ! ) " TCP 3
)! = TCP ( 5 3 TCP Socket Function
! = "Process
!5 " 3
)!C ! ) ?G. 3
( ! ] Process : Socket Function
)
F $H0 K 9 *$ 9Message L !
) ! = "Read, Write, Accept !
Function ( ' 8
F $ ( ' 8$ $ !
, (
&(6 F +G H &@ ( !C ! A Object 7 29 )
! ?." 3
)! _ TCP ( Socket e =
TCP

g (!

H 5 &@ !

+ C2 ! 5 A C2!
!) @

) ;1 I +

+V )

Socket Programming

9! ) ' 8

Process

244

Socket

! !

( )
12&

f1

! )A C2Welcome &
Socket
( Function B
12& !
!5 Client K ( A
2
' NProcess Server )
C Socket >!5 A C2
5 ?." .]
# *+
+V )
5
@ Client Socket B !C 5
Client Process B ! Client
+V )
IP M N $ Client Socket D$ !$ ) $" 3
Server
+V ) )
Client Socket G< )
(+
,Port Number
$ A $ $ = A $ $ &!$" 9 $
,Port Number IP M N 2
Client Socket
!
!)
2 Welcome Socket J K ( Client
=
)!
Connection Socket &
! ! Socket (! ' &!" 3
@ 7
E
F 6 Connection
+E
" K Client +=
S F < Connection Socket
+E F < Data
g!+)
(7 5 #+)h
% d 2F S+[ )
+V $) Client +V $) $)!$++ $ 7 5
+V $)
$ 1$2& $ !
i 8 Server
W V$ ($ $ Server Process $5
Welcoming > ) Run > ) Call Server Process
+
! ) @ Q = > Socket B Socket
5 M
@ R
O
5 A C2 ) Client
Client Socket ! ) A C2 Client Socket G< 20
F $$, ' $$5
$$ IP Address $$5 $$+=
$@ !$) $ 3
@ &!" Welcoming Socket
>U 7 5 ) .
5 &@ TCP 4 3
>
Three-way handshake F +G H !
2K
0 ) TCP + GO
$@ TCP Connection $) $ j $S
5
@ TCP Connection B @
5 &@
TCP
Q $8+k ?$" Connection Socket $ !$) Connection Socket &
! ! Socket > ) Run &!" 9 )
$5 3
0)
U+ !C > 1 !
B ) @ N( 8E!
+
Client Data A
U+
+V ) )!+)i 2!+
5 9!5
A
= 2
Welcoming Socket B
!C B
e $= Client B $ Data A
+ l* Connection Socket
Connection Socket
5 m _U M N 7"!O 5 A C2
0 ) +V ) ) L Socket
Connection Socket
Connection $ $5 $E
! * Socket >N '! )m _U f1
YF , ' 5 L IP M N X
Port Number Server IP Address $ X $5 m _U M Nn /
0 H Connection Socket !+ 'L Socket
L
+V )
Y 0 ) +V )
Port Number Client IP Address
m _U$

Connection Socket

)!5

>

M Nn

245

! *
3

S Connection Socket > Z


0 ) Z '!5 @
Z

#$ % & '

'

G+= A \ ! 5 5N 5 S

!+

( )

5 #+)

* Server " Client

[ H

> (I "

$) $
'!5 5
) 12&
( !
B
0) +V )
!$) $ @
TCP A
A$
$
$ !+G) ! 1 ) !+G)
)
>N9 ) 2
!+G)
) ( !C
5
$ ' $)7 !$ Upper Case Lower Case O (
S8<
>N#
0 )# *+ ! E
0)
H $ A $\ B $ !$++ ) .
!
^
7 $5 Socket Programming F +G H +G)
# *$+ $) $2 E A \ I " >
5
$K !$+) $ RO0 ) G 5 W , ! ) ) LZ
! ) m _U A \ 0)
12& F Z G2 G 5
Software # ( $,
^_
YServer ^ _ Client ^ _ X
!$ $) '!$5 ' 5 #++ Server ^ _ !
Create Socket C 5
@ Socket B
$
! = Welcoming ( Socket
$@
/0 \ ) Port Number B Socket
m _U$$ +V $) IP M N '!$$5 m _U$$ X
) ( !C 5
Welcome Socket ?"
$2
' $ NWelcome Socket '!5 @
9#+$ 'L Client K E
TCP 3
Client B $ $@
Client F +G H )#++
@
,
!C 5
5 Socket
+V ) IP M N'!5
$ TCP $ 3
@ &!" 0) TCP W V
5 '
Welcoming Socket F , ' 5
9!5 " 3
) ( !C ! )
!$) $ $ 0 )
e = Connection Socket B @ &!"
=
) +E
" O
$
@ !)
2
>N! )A
0 ) ) Request
Read
B !C 5 ' 8
0) )
Socket F
( B ) Send X '!5 '! 7 5
Y 5 '8
S )
!$ A
K
* )! ) !+, >
0 ) Send
A$
>NTCP ! ! TCP
7 5
+L Application ( * )
Q ) Send : Socket ?"
#
!
Connection Socket ( >N!$5 $2
*$ $E $) $
Q ) Read oSocket
) )B % *
A\
/0 \ +E
"' 8
!
@
)
* /C." +L K
246

2E )

: Socket Write
!C 5 7 ! Upper Case Lower Case (
)
'!5 @
* )! ) # 2 >
5
Connection
$+L "Connection Socket +=
Socket L F H
"Read ?[
#
0 ) ! )A
0)
TCP J K (
* # Socket
$; "'!5 2 F H0 K Client Socket
( )! ) # 2 >
Socket Read
' )A C2 Read
$
K
0 )( !
) )B !++ ) .
E
$@ !$ E >NUpper Case $
$)'!$5 $2 E $R
$K !++ ) .
12&
5&
5p" !
0 ) 12&
E
Connection Socket
E +C[
) (7 "
A C2Welcoming Socket ) +C[
$ $ 0 )( * B 9! ) " 3
0 )B 4]2 )
' +* A \ B
!
e = 0)
$"
$ $ $ W V$
5 *
0)>N 3 Connection Socket !C 9 E q ,B 9
5' N L
0) 3
I " '!5 ' -+[ A \ #+ _ E
g#++ ^ _
9#+)
Java
A CJK
Header ^ $_ B
$) #$
Java
Statement #
F $+G H!$ $ '( ) Import Java.io @
&$@ + $
)
/0 \
=
5
# >N( !C Networking F +G H .
$ M 0$) B h
G
Networking
!) @
5 C. r ) K
^_
Write

247

TCP UDP -

12&

Connection Less

!)

'8

Connection Socket

Welcoming Socket

&1+

( 2

A
"

>N ' $) $2

Received Packet

$ '!$5 $2

248

"

&+ " ,

UDP
UDP

. / 0 UDP -

!$$++ $
$ 0 ) $K 4$$]27 $5 $
$K !$ $ > U 7 5 ) .
User
Input
$5 $ Input Stream B ! !
' $)s User )
) ) Stream
$ ,4 ! >N( !C !
Q =
>N#$ $ $) $5
* B
0)
$
*$ *
9#+5DE Send Packet
' 7$ S UDP Client Socket J K ( )
A$
$
$ >N#$$ UDP $5 $
q$ , ! ) 2
_ ,UDP E ! )
$$+= Client Socket $$ ( ' 8$$ $$
!
" 0 ) Socket
0 ) 12& # !C
*$ Socket $ $; "
!
^
+
S8<

contineue

" #$ %&' ()

!
/
2+
30
< 3 < 6< 7 :< * = 3 > $ %
Content

Content Distribution

(4 5 *
/ 01 Server +* ,- .
object *
/ ;3
3 6 ,- . 7 8 9* : ' 9 Content
:
7 8 9 Content 4 ! ?
32*
:!
.( 0 3 *" %* # ! />( : ' 9*7 8 9Content @
<!C :< :D E :!! F(
G 0 $ %& ' *" @
6
+
> $ %
Cost BA
<
< :<
@ ,- .
> J K *:( ! 9 / ;3 + C ( HD(
!C 6 I:! :
> 30 :( 3 @ E L C " @ :( 3
:!! F(
F :!( 3 :!!
:!E :! 7 G 2* :D E : +
Performance BM
+P+ @ E
Content ?
= 3
:% Performance Cost N O "G 5 > $ %
Q ! R (* ,- . :(
<!
Q< ! * 6 *
Performance Cost N O "G 5 + *P6 9
<T +P
U " 2V
*/
W N O "G 5 :!( 3 :!! S ( 7 : 6 CT '
*
:!!
:! 3 R O 6
/:.% V D(:!(
Proxy Cache Server X Proxy Caching BA
:( Content ?
Y % :!(
(P
!P Server Mirror BM
[
"1
V
! / ;3
Q ! 6 Z:
S5
+
* <

<; <!C V < < :(

0
*

3(+

X Document @ + *P :
(
) C(+
3(+ $ : V
(

Server

:( ! 9V
4 $ 2* )

7 '

0 V
" S D3( ! +

Caching

< C( :!3 <


< + : '*
<U :!! / ;3 G 0 "
< C(
^* V ] * @

7 8
Content
K (@
:! + !% Caching /:
:! " + :! \
@
) > $ %
: >(+
" 6
K (@ ) #:!! F( FG * * *
" 6
6
[" ,H2
6
)
:3
4
/
2
(P
$ %& '
$ %& '

FG *

:D # *

Cache Server

249

FG *

3
3

@
3 0

% +

+: *:_
6 "

6< < < 3

Server

@ < + <3

/: / 01 HD(@

Content

: 0

@
6 "
+ !`. Content
Caching ! "

/:

! V 9 ( $ %& ' +

Cache

<32*,& \ :! Cache a 0
* *P
%&'
6 + 6 /
< < $ <%& '
< V <K #:<(* < >
3 * :!! / ;3 Web Browser +
U :
(P
Local
0
3 @ ,- .
Temporary Internet Files Z(
Settings
<
N * . 32*?2* !
/ 01b :!! / ;3 *:!*
3
* < < : >( .
: ! / 01 (P 6 +*: : ! /: d
_;G : (
c F3K
(P *: ! / *
(P: ( : " ) : $
Local ZC(< @ < ?<2* 6< :< ! / ;3<
Caching
/ <01a <0 3 < "<0 " 6
*P
:
%& ' :(
8K
:!
< / <01$ <F.% < Cache Server

< < <3;) Cache Server ZC( / ;3 Network Caching


:!
ZT(+
* / *:_
7 8 9 Content
Proxy

[: !

#$

/: d @ F. " @ T!
/: ! V 9" 6
8 !%
:!! / ;3 !&
:!3 +
G !%
6< ,& \< < :( < <
<% .T @ +
:
@ *
@ #/>d( @
"e
:(
% .T
f
< < 3
< ISP @ < < :< ( < :
:!! / ;3 (3!
:!3
> 8 !%
* < content g:< * < 6<
3 W) ^ *
* ] Origin Server (P
* < </
<2 <
6
5 3 * ^IHub] ,i:3 $ %& ' * Content h 9 :3 3_ * $ %& '
/
2
+
30 h
8 !%
Proxy cache Server Proxy Server Z
>!
!& [:! ".% " 6 : *
C(
$ %& ' *:!(C
origin Server :!F
0
0 #:!! F( h */ : 9 T(P
0 (
Proxy Cache h <9 :!3<
< Cache Server < :<3
a <0 : N U +
0 :
2Proxy 6 ) T! :!
+
* 3 0 Server
$ 8! e :
N U
+ < <( < $ <%& ' *j 9+ *P
h 9*:3
Origin Server
:! S
!&
h */ / 01 0
+P :3

250

<T!
< < O % > " " 2" k O
!&
:! l
:<!F *:<!! / ;3 HTTP " * 9
< <!& " < m <H :<!(C < ;F3K
* N*
:!! S Proxy Server
0 HTTP 3 0
a <0 Response < :< 3<
j 9 ) Proxy Server
3 :( ) *
$ %& '
*
Request #:
< (P#$ %& '
h 9*/ .(S
Original $ G
:! S
!&
: */ / 01a 0 3
: ! T!
[ V D(*
Proxy Server
< Origin Server
Z - $ <%&' */
Origin Server +
" _ ^
: 0 " **4 ( !
T! Proxy .F :
:
ZT( Origin Server
:< *:<!

/ 01a 0 3

*P
:!

/ ;3

: (Proxy Cache Server

( ! Proxy Server % &"


!& ] +
h */
3 $ F.% !& 7 ' h 9

%&' -,*
! 6 : Cache Server % &"
!&
>K 9 ! /: / 01$ %& ' 6
+P+
h 9# Cache V D( *
Proxy V D(
W
[
U 3 /: i $ _ O
:!
:!
#:

!& @ V D(Proxy Server

* @ V D(Proxy Server
!&
0
>!
# <3 ) < 0 < :<! < < * @ V D( T!
Proxy Server
"
) : j 9+P
:!
*/
H
:!( ?2*
: : Requestj 9:( 3 / Cache
a 0 Response */ j 9 * @
<U 3 < h <9 :!
K 9*/ 3 Origin Server
Request !& @ V D( $ 8 ! e
CZ(
* gCU @ * !& gCU @
4 8 (Proxy Server
Origin +* < :
%& ' .:2+Q* Proxy Server /: / 01$ %&' ) : ! 8 0 V 9 6 .
Server
origin Server "< 6< < Cache
F < Proxy Server 6 h 9 > $ %
I
E
n
Proxy Server <) :<(/ <
< <
O*6
Proxy Server
3
,- .
Update */
:<! p Kd :(
#If-modified-since Z(
U* HTTP
G 0 Header / ;3 : N * o
% ,-*
5& " 2 '
T + 6 ZC( 6 / ;3 :
2/ ;3
(Q* E
:! : 9V
/ ;3
R .T
:( ! 9,(q* * - $ %& '
3

251

4 1


.
Stimated RTT -5 Average RTT .
Stimated RTT ) (1- Stimated RTT +
) (Sample RTT Pattern Moving Average
.
RTO -6 Acknowledge
4 ' Sample RTT
' Sample RTT 4 5 RTO 6
.
2000 RFC 2988 TCP - Timer
. 1/8 1/4 Default
.

252

4 2
TCP Server FINISHED ESTABLISHED
CLOSE_WAIT . ACK FIN
. TCP LAST_ACK . ACK
TCP CLOSED .

253

You might also like