unit1- data communication
TRANSCRIPT
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 1/172
Data Communication
Components
Data Representation
Direction of Data Flow
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 2/172
Five components of data communication
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 3/172
Simplex
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 4/172
Half-duplex
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 5/172
Full-duplex
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 6/172
Networks
Distributed Processing
Network Criteria
Physical Structures
Categories of Networks
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 7/172
Point-to-point connection
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 8/172
Multipoint connection
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 9/172
Categories of topology
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 10/172
Figure 1.8 Fully connected mesh topology (for five devices)
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 11/172
Mesh.
• A network that uses a mesh topology provides a direct connection
between each pair of computers. The chief disadvantage of a mesh
arises from the cost: a mesh network connecting n computers
requires:
• The important point is that the number of connections needed for a
mesh network grows faster than the number of computers. Because
connections are expensive, few LANs employ a mesh topology.
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 12/172
Mesh Topology
• Every Link carries its own
data avoids traffic
problems.
• Robust as alternative
path is available
• Privacy & Security as
dedicated link is there
only desired user can see
the message
• Troubleshooting is easy
• Large amount of cabling.
• No. of I/O ports requirdare more (N-1).
• Installation and
Reconnection are difficult
(scalability).
• Expensive.
• In a limited application or very good for to be used
as backbone.
S l
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 13/172
Star topology
A network uses a star topology when all computers attach to a central point.
Because a star-shaped network resembles the spokes of a wheel, the
center of a star network is often called a hub. A typical hub consists of an
electronic device that accepts data from a sending computer and delivers it
to the appropriate destination. In practice, star networks seldom have a
symmetric shape in which the hub is located an equal distance from all
computers. Instead, a hub often resides in a location separate from the
computers attached to it. For example, computers can reside in individualoffices, while the hub resides in a location accessible to an organization’s
networking staff.
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 14/172
Star Topology
• Less Expensive one link
and one I/O port only per
device.
• Easy installation ,
reconfiguration, addition
and deletion of nodes.Less cabling
• Robust- only affected link
is inactive.
• Easy troubleshooting.
• Works effectively as long
as hub works.
• More cabling as
compared to ring or bus.
B t l
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 15/172
Bus topology
A network that uses a bus topology usually consists of asingle cable to which computers attach†. Any computer
attached to a bus can send a signal down the cable, and all
computers receive the signal. Because all computers attachdirectly to the cable, any computer can send data to any
other computer. Of course, the computers attached to a bus
network must coordinate to ensure that only one computer
sends a signal at any time.
B T l
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 16/172
Bus Topology• Ease of installation.
• Less cabling efficientbackbone.
• Due to tap signal becomesweaker and weaker as ittravels farther & farther.Hence limitation of distance
and no. of nodes.• Includes difficult
reconnection (splicing).
• Difficult Troubleshooting.• Addition, Deletion is difficult.Signal reflection at tapdegrades quality may
involve backbone cablereplacement.
• A fault or break in cable
causes reflection noise andinterruption in transmission.
Ring topology
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 17/172
Ring topology
A network that uses a ring topology arranges for computers to be connected
in a closed loop — a cable connects the first computer to a second computer,
another cable connects the second computer to a third, and so on, until a
cable connects the final computer back to the first. Some technologies that
use a ring topology require a computer to connect to a small device that
forms the ring. The advantage of using a separate device lies in the ability of
the ring to continue operation even if some of the computers are
disconnected. The name ring arises because one can imagine the computers
and the cables connecting them arranged in a circle as Figure 13.7 illustrates.
In practice, the cables in a ring network do not form a circle. Instead, they run
along hallways or rise vertically from one floor of a building to another.
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 18/172
Ring Topology• Media and Traffic
consideration constraints.
• Maximum ring length maytake time to reach signal
to destination. The
requisite node can raise
an alarm.
• A break in ring disrupts
entire network , solved by
using dual ring.
• Easier installation ,
reconfiguration.
• Addition and Deletion iseasier.
• Fault isolation is easier.
Reason for Multiple Topologies
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 19/172
Reason for Multiple Topologies• Each topology has advantages and disadvantages. A
ring topology makes it easy for computers to coordinateaccess and to detect whether the network is operatingcorrectly. However, an entire ring network is disabled if one of the cables is cut. A star topology helps protect thenetwork from damage to a single cable because eachcable connects only one machine. A bus requires fewer wires than a star, but has the same disadvantage as a
ring: a network is disabled if someone accidentally cutsthe main cable. Later chapters that describe specificnetwork technologies provide additional details aboutdifferences. For now, it is sufficient to understand:
• Networks are classified into broad categories according to their general shape. Although a mesh topology is possible, the primary topologies used with LANs are star,
ring, and bus; each has advantages and disadvantages.
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 20/172
Exercise
• Draw a hybrid topology with a Star withtwo Buses each with 3 Rings of 4 devices
each
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 21/172
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 22/172
Exercise
• For n devices in a network the number of
cable links required for Mesh, Ring , Busand Star topology is…
• Mesh: n (n – 1) / 2• Star: n
• Ring: n – 1
• Bus: one backbone and n drop lines
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 23/172
Exercise
• Mesh: secure
• Bus: easy installation
• Star: robust
• Ring: easy fault isolation
• Mesh: easy installation
• Bus: easy fault isolation
• Star: secure
• Ring: robust
Categories of networks
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 24/172
g f
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 25/172
Network Types
LAN
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 26/172
LAN (Continued)
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 27/172
Figure 1.14 MAN
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 28/172
WAN
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 29/172
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 30/172
Network: Links & switches
• Circuit consists of dedicated resources in
sequence of links & switches across network
• Circuit switch connects input links to output linksSwitch
Network Control
12
3
N
12
3
N
Connection
of inputs
to outputs … …User 1
SwitchLink
User n
User n – 1
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 31/172
Switching Methods
• Circuit Switching.
• Packet Switching.
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 32/172
Circuit Switching.• The term circuit switching refers to a
communication mechanism that establishes a
path between a sender and receiver withguaranteed isolation from paths used by other
pairs of senders and receivers. Circuit switching
is usually associated with telephone technologybecause a telephone system provides a
dedicated connection between two telephones.
In fact, the term originated with early dialuptelephone networks that used electromechanical
switching devices to form a physical circuit.
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 33/172
Circuit Switching
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 34/172
Circuit Switching• Currently, circuit switching networks use electronic
devices to establish circuits. Furthermore, instead of having each circuit correspond to a physical path,
multiple circuits are multiplexed over shared media,and the result is known as a virtual circuit . Thus, thedistinction between circuit switching and other forms
of networking does not arise from the existence of separate physical paths. Instead, three generalproperties define a circuit switched paradigm:
• Point-to-point communication• Separate steps for circuit creation, use, andtermination
• Performance equivalent to an isolated physical path
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 35/172
Circuit Switching
• The first property means that a circuit is formedbetween exactly two endpoints, and the second
property distinguishes circuits that are switched (i.e., established when needed) from circuits thatare permanent (i.e., always remain in place
ready for use). Switched circuits use a three-step process analogous to placing a phone call.In the first step, a circuit is established. In the
second, the two parties use the circuit tocommunicate, and in the third, the two partiesterminate use.
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 36/172
Circuit Switching
• The third property provides a crucial distinctionbetween circuit switched networks and other
types. Circuit switching means that thecommunication between two parties is notaffected in any way by communication amongother parties, even if all communication ismultiplexed over a common medium. Inparticular, circuit switching must provide theillusion of an isolated path for each pair of
communicating entities. Thus, techniques suchas frequency division multiplexing or synchronous time division multiplexing must beused to multiplex circuits over a shared medium.
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 37/172
Conclusion
• Circuit switching provides the illusion of an
isolated physical path between a pair of communicating entities; a path is created
when needed, and discontinued after use.
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 38/172
Packet Switching
• The main alternative to circuit switching, packet switching , forms the basis for the Internet. A packet
switching system uses statistical multiplexing in whichcommunication from multiple sources competes for theuse of shared media. The chief difference betweenpacket switching and other forms of statistical
multiplexing arises because a packet switching systemrequires a sender to divide each message into blocks of data that are known as packets. The size of a packet
varies; each packet switching technology defines amaximum packet size.
Packet Switching
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 39/172
• Arbitrary, asynchronous communication
• No set-up required before communication begins• Performance varies due to statistical multiplexing among
packets
• The first property means that packet switching can allowa sender to communicate with one recipient or multiplerecipients, and a given recipient can receive messagesfrom one sender or multiple senders. Furthermore,communication can occur at any time, and a sender candelay arbitrarily long between successivecommunications. The second property means that,unlike a circuit switched system, a packet switchedsystem remains ready to deliver a packet to any
destination at any time. Thus, a sender does not need toperform initialization before communicating, and doesnot need to notify the underlying system whencommunication terminates.
P k t S it hi
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 40/172
Packet Switching
• The third property means that multiplexing
occurs among packets rather than among bits or
bytes. That is, once a sender gains access to
the underlying channel, the sender transmits an
entire packet, and then allows other senders totransmit a packet. When no other senders are
ready to transmit a packet, a single sender can
transmit repeatedly. However, if N senders eachhave a packet to send, a given sender will
transmit approximately 1/N of all packets.
P k t S it hi
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 41/172
Packet Switching
• One of the chief advantages of packet
switching is the lower cost that arises fromsharing. To provide communication among
N computers, a circuit-switched network
must have a connection for each computer plus at least N/ 2 independent paths. With
packet switching, a network must have aconnection for each computer, but only
requires one path that is shared.
C l i
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 42/172
Conclusion
• Packet switching, which forms the basis of
the Internet, is a form of statistical multiplexing that permits many-to-many
communication. A sender must divide a
message into a set of packets; after transmitting a packet, a sender allows
other senders to transmit beforetransmitting a successive packet.
Comparison
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 43/172
Comparison
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 44/172
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 45/172
Comparison
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 46/172
Comparison
• Propagation delay. The time it takes a signal topropagate from one node to the next. This time
is generally negligible. The speed of electromagnetic signals through a wire medium,for example, is typically 2 X lo8 mts.
• Transmission time. The time it takes for atransmitter to send out a block of data. For example, it takes 1 s to transmit a 10,000-bitblock of data onto a 10-kbps line.
• Node delay. The time it takes for a node toperform the necessary processing as it switchesdata.
Ci it S it h T
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 47/172
Circuit Switch Types
• Space-Division switches
– Provide separate physical connection
between inputs and outputs
– Crossbar switches
– Multistage switches
• Time-Division switches
– Time-slot interchange technique – Time-space-time switches
• Hybrids combine Time & Space switching
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 48/172
Space Division Switching
Crossbar Space Switch
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 49/172
Crossbar Space Switch
• N x N array of
crosspoints
• Connect an input
to an output by
closing a
crosspoint
• Nonblocking: Any
input can connectto idle output
• Complexity: N 2
N
1 2
1
N
2
N –1
…
…
crosspoints
Multistage Space Switch• Large switch built from multiple stages of small switches
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 50/172
• Large switch built from multiple stages of small switches
• The n inputs to a first-stage switch share k paths throughintermediate crossbar switches
• Larger k (more intermediate switches) means more paths tooutput
• In 1950s, Clos asked, “How many intermediate switchesrequired to make switch nonblocking?”
2(N/n)nk + k (N/n)2 crosspoints
n×k
n×k
n×k
n×k
N/n × N/n
N/n × N/n
N/n × N/n
k ×n1
2
N/n
N
inputs
1
2
3 3
N/n
N
outputs
1
2
k
k ×n
k ×n
k ×n
… … …
Clos Non-Blocking Condition: k=2n-1
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 51/172
Clos Non Blocking Condition: k 2n 1
nxk
nxk
nxk
N/n x N/n
N/n x N/n
N/n x N/n
k xn1
N/n
Desired
input
1
j m
N/n
Desired
output
1
2n -1
k xn
k xn
n-1
N/n x N/nn+1
N/n x N/n2n-2
Free path Free path
n-1
busy
n-1
busy
…
… …
…
• Request connection from last input to input switch j to last output in outputswitch m
• Worst Case: All other inputs have seized top n-1 middle switches AND allother outputs have seized next n-1 middle switches
• If k=2n-1, there is another path left to connect desired input to desired output
# internal links =2x # external links
Minimum Complexity Clos Switch
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 52/172
Minimum Complexity Clos Switch
C(n) = number of crosspoints in Clos switch
= 2Nk + k ( )2 = 2N (2n – 1)+(2n – 1)( )2
Differentiate with respect to n:
0 = = 4N – + ≈ 4N – ==> n ≈ √
The minimized number of crosspoints is then:
C* = (2N + )(2( )1/2 – 1) ≈ 4N √ 2N = 4 √ 2N 1.5
This is lower than N 2 for large N
N 2
N /2
2N 2
n2
2N 2
n3
2N 2
n2
N
2
δC
δn
N
n
N
n
N 2
Example: Clos Switch Design
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 53/172
Example: Clos Switch Design
• Circa 2002, Mindspeed offered a Crossbar chip with the following specs:
– 144 inputs x 144 outputs, 3.125
Gbps/line – Aggregate Crossbar chip throughput:450 Gbps
• Clos Nonblocking Design for 1152x1152switch
– N=1152, n=8, k=16
– N/n=144 8x16 switches in first stage
– 16 144x144 in centre stage
– 144 16x8 in third stage
– Aggregate Throughput: 3.6 Tbps!
– Note: the 144x144 crossbar can bepartitioned into multiple smaller switches
8x16
8x16
8x16
8x16
144×144
144x144
144x144
16x8 1
2
144
1 1 5 2
i n p u t s
1
2
3 3
N/n
1 1 5 2
o u
t p u t s
1
2
16
16x8
16x8
16x8
… … …
Ti Di i i S it hi
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 54/172
Time Division Switching
Space
SwitchTime
Switch
Hybrid
•Time Division switches are cost effective as
compared to space switches.
Time Division Space Switching
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 55/172
Time Division Space Switching•Each inlet & outlet is asingle subscriber line
•Sampling rate is 8 Khz.
hence T= 125 µs.•Simultaneous conversationsor switching capacity = 125µs/ ts , where ts is time
required for transfer of onevalue.
•A single switching elementand a bus is time shared
and a physical connection isestablished between oneinlet & outlet for time tshence is TD Space switch
1
.
.
N
1
.
.
N
Counter – N-
Decoder 2N
Non blocking
No full availability :- i.e. any inlet cannot be connected to any outlet.
• Thus to achieve full availability
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 56/172
• Thus to achieve full availability
following types of TDS switches canbe used,
Input controlled TDS switch.
Output controlled TDS switch.
Memory controlled TDS switch
Input Controlled TDS Switch
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 57/172
Input Controlled TDS Switch1
.
.
N
1
.
.
N
Counter – N-
Decoder 2N
MAR
5
Time-Slot Interchange (TSI)Switching
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 58/172
1
23
22
23
24
Write
slots inorder ofarrival
Read slots
according toconnectionpermutation
24 23 12
Time-slot interchange
24 23 12abcd b a d c
a
b
c
d
… …
• Write bytes from arriving TDM stream into memory
• Read bytes in permuted order into outgoing TDMstream
• Max # slots = 125 µsec / (2 x memory cycle time)
Switching
Incoming TDM
stream
Outgoing TDM
stream
Time-Space-Time Hybrid Switch
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 59/172
Time Space Time Hybrid Switch• Use TSI in first & third stage; Use crossbar in middle
nxk
nxk
nxk
nxk
N/n x N/n k xn1
2
N/n
N inputs
1
3
1
…
1
2
n
Time-slot interchange
Input TDMframe with
n slots
Output TDM
frame with k
slots
n … 2 1 k … 2 1
• Replace n input x k output space switch by TSI switch that takes n-slot input frame and switches it to k-slot output frame
Flow of time slots between
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 60/172
n × k N/n × N/n
N/n × N/n
N/n × N/n
k × n1 1
2
N/n
1
2
k
k × n
k × n
n × k 2
n × k N/n
First slot
k th slot
First slot
k th slot
… … …
switches
• Only one space switch active in each time slot
Time-Share the Crossbar Switch
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 61/172
nxk
nxk
nxk
nxk
N/n x N/n
Time-shared
space switch
k xn
1
2
N/n
N
inputs
1
2
3 3
N/n
N
outputs
TDMn slots
n slots
n slots
n slots
k xn
k xn
k xn
TDMk slots
TDMk slots
TSI stage TSI stageSpace stage
… …
• Interconnection pattern of space switch isreconfigured every time slot
• Very compact design: fewer lines because of TDM & less space because of time-sharedcrossbar
Example: A→3, B→4, C→1, D→3
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 62/172
A
B
C
D
(a)C
A
D
B
p , , ,
3-stage
SpaceSwitch
2x3
2x3
3x21
2
1
23x2D1
B1 A1B2 A2
C1D2 C2
B1 A1
C1D1
A1
B1
C1
D1
A1 C1
B1 D1
(b)
Equivalent TST Switch
Example: T-S-T Switch Design
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 63/172
For N = 960• Single stage space switch ~ 1 million
crosspoints
• T-S-T – Let n = 120 N/n = 8 TSIs
– k = 2n – 1 = 239 for non-blocking
– Pick k = 240 time slots – Need 8x8 time-multiplexed space switch
For N = 96,000• T-S-T
– Let n = 120 k = 239
– N / n = 800 – Need 800x800 space switch
Available TSI Chips circa 2002
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 64/172
p
• OC-192 SONET Framer Chips
– Decompose 192 STS1s and perform(restricted) TSI
• Single-chip TST
– 64 inputs x 64 outputs
– Each line @ STS-12 (622 Mbps) – Equivalent to 768x768 STS-1 switch
Pure Optical Switching
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 65/172
• Pure Optical switching: light-in, light-out, withoutoptical-to-electronic conversion
• Space switching theory can be used to design
optical switches – Multistage designs using small optical switches
– Typically 2x2 or 4x4
– MEMs and Electro-optic switching devices
• Wavelength switches
– Very interesting designs when space switching iscombined with wavelength conversion devices
Exercise
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 66/172
• Construct A three stage switch with N = 16,
n = 4, k = 2.
• Repeat all questions for k=4 and k=10.
• What is the maximum number of connections that can be
supported at any given time?
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 67/172
pp y g
– Thus, the second stage is the bottleneck, and blocking can occur inthe first stage. Thus, eight connections can be supported at a time. If
k = 4, then blocking will occur if we are not allowed to rearrange
connections. It can be shown that in this case blocking can be
avoided if we are allowed to rearrange the connection pattern everytime a new connection request is made. If k = 10, then there are ten
4 x 4 switches in the second stage. Since there are only 16 inputs
and 16 outputs, the switch can accommodate any set of connections
without blocking.
• For a given set of input-output pairs, is there more than
one way to arrange the connections over the multistage
switch? – As shown in the picture in part (a), it is clear that each input-output
pair can be connected through any one of the k second-stage
switches. Thus, here are k ways to arrange the connections over amulti-stage switch.
Exercise
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 68/172
• What is the delay incurred in traversing a TSI
switch? – The arriving frame is written onto the switch
register and after the frame is completely
written in, it needs to be read out in permutedorder.
Protocols
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 69/172
• A protocol is a set of rules that governshow two or more communicating entities ina layer are to interact
• Messages that can be sent and received
• Actions that are to be taken when a certainevent occurs, e.g. sending or receivingmessages, expiry of timers
• The purpose of a protocol is to providea service to the layer above
Layers
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 70/172
• A set of related communication functions thatcan be managed and grouped together
• Application Layer: communications functionsthat are used by application programs – HTTP, DNS, SMTP (email)
• Transport Layer: end-to-end communicationsbetween two processes in two machines – TCP, User Datagram Protocol (UDP)
• Network Layer: node-to-node communicationsbetween two machines – Internet Protocol (IP)
Summary
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 71/172
• Layers: related communications functions – Application Layer: HTTP, DNS
– Transport Layer: TCP, UDP
– Network Layer: IP• Services: a protocol provides a communications
service to the layer above – TCP provides connection-oriented reliable byte transfer
service – UDP provides best-effort datagram service
• Each layer builds on services of lower layers
– HTTP builds on top of TCP – DNS builds on top of UDP
– TCP and UDP build on top of IP
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 72/172
Applications and LayeredArchitectures
OSI Reference Model
Why Layering?
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 73/172
• Layering simplifies design, implementation, andtesting by partitioning overall communications
process into parts• Protocol in each layer can be designed
separately from those in other layers
• Protocol makes “calls” for services from layer below
• Layering provides flexibility for modifying andevolving protocols and services without havingto change layers below
• Monolithic non-layered architectures are costly,inflexible, and soon obsolete
Open Systems Interconnection
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 74/172
• Network architecture:
– Definition of all the layers
– Design of protocols for every layer
• By the 1970s every computer vendor haddeveloped its own proprietary layered networkarchitecture
• Problem: computers from different vendors
could not be networked together • Open Systems Interconnection (OSI) was an
international effort by the International
Organization for Standardization (ISO) to enablemultivendor computer interconnection
OSI Reference Model
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 75/172
• Describes a seven-layer abstract referencemodel for a network architecture
• Purpose of the reference model was to provide aframework for the development of protocols
• OSI also provided a unified view of layers,
protocols, and services which is still in use in thedevelopment of new protocols
• Detailed standards were developed for eachlayer, but most of these are not in use
• TCP/IP protocols preempted deployment of OSIprotocols
7-Layer OSI Reference Model
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 76/172
Application
Layer
Presentation
Layer
Session
Layer
TransportLayer
Network
Layer
Data LinkLayer
Physical
Layer
Application
Layer
Presentation
Layer
Session
Layer
TransportLayer
Network
Layer
Data LinkLayer
Physical
Layer
Network
Layer
Application Application
Data LinkLayer
Physical
Layer
Network
Layer
Data LinkLayer
Physical
Layer
Communicating End SystemsOne or More Network Nodes
End-to-End Protocols
Physical Layer
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 77/172
• Transfers bits across link
• Definition & specification of the physicalaspects of a communications link – Mechanical: cable, plugs, pins...
– Electrical/optical: modulation, signal strength, voltage
levels, bit times, … – functional/procedural: how to activate, maintain, and
deactivate physical links…
• Ethernet, DSL, cable modem, telephonemodems…
• Twisted-pair cable, coaxial cable optical fiber,
radio, infrared, …
Data Link Layer
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 78/172
• Transfers frames across direct connections
• Groups bits into frames
• Detection of bit errors; Retransmission of frames• Activation, maintenance, & deactivation of data link
connections
• Medium access control for local area networks
• Flow control
Data Link
Layer
Physical
Layer
Data Link
Layer
Physical
Layer
frames
bits
Network Layer
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 79/172
• Transfers packets across multiple links and/or
multiple networks
• Addressing must scale to large networks
• Nodes jointly execute routing algorithm to
determine paths across the network• Forwarding transfers packet across a node
• Congestion control to deal with traffic surges
• Connection setup, maintenance, and teardown
when connection-based
Internetworking
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 80/172
• Internetworking is part of network layer andprovides transfer of packets across multiple
possibly dissimilar networks• Gateways (routers) direct packets across
networks
G = gateway
H = host
Net 1
Net 5
Net 3
Net 2
HNet 3
G
H
H
H
GG
GG
G
Net 1
Net 2 Net 4
Net 5
Ethernet LAN
ATM
Switch
ATM
Switch
ATMSwitch
ATM
Switch
ATM
Network
Transport Layer
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 81/172
• Transfers data end-to-end from process in amachine to process in another machine
• Reliable stream transfer or quick-and-simplesingle-block transfer
• Port numbers enable multiplexing
• Message segmentation and reassembly
• Connection setup, maintenance, and release
TransportLayer
Network
Layer
TransportLayer
Network
Layer Network
Layer
Network
Layer
Communication Network
Application & Upper Layers
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 82/172
• Application Layer: Providesservices that are frequently
required by applications:DNS, web acess, file transfer,email…
• Presentation Layer: machine-independent representation of data…
• Session Layer: dialogmanagement, recovery fromerrors, …
Application
Layer
Presentation
Layer
Session
Layer
TransportLayer
Application
Application
Layer
TransportLayer
Application
Incorporated intoApplication Layer
Headers & Trailers
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 83/172
• Each protocol uses a header that carries addresses,sequence numbers, flag bits, length indicators, etc…
• CRC check bits may be appended for error detection
Application
Layer
Transport
Layer
NetworkLayer
Data Link
Layer
PhysicalLayer
Application
Layer
Transport
Layer
NetworkLayer
Data Link
Layer
PhysicalLayer
Application ApplicationAPP DATA
AH APP DATA
TH AH APP DATA
NH TH AH APP DATA
DH NH TH AH APP DATA CRC
bits
OSI Unified View: Protocols
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 84/172
• Layer n in one machine interacts with layer n inanother machine to provide a service to layer n
+1• The entities comprising the corresponding layers
on different machines are called peer processes.
• The machines use a set of rules andconventions called the layer-n protocol .
• Layer-n peer processes communicate byexchanging Protocol Data Units (PDUs)
n
Entityn
Entity
n-PDUs
Layer n peer protocol
OSI Unified View: Services
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 85/172
• Communication between peer processes is virtualand actually indirect
• Layer n+1 transfers information by invoking theservices provided by layer n
• Services are available at Service Access Points( SAP’s)
• Each layer passes data & control information to thelayer below it until the physical layer is reached andtransfer occurs
• The data passed to the layer below is called aService Data Unit (SDU)
• SDU’s are encapsulated in PDU’s
Layers, Services & Protocols
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 86/172
n+1
entity
n-SAP
n+1
entity
n-SAP
n entity n entity
n-SDU
n-SDU
n-SDU
H
H n-SDU
n-PDU
Interlayer Interaction
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 87/172
layer
N+1 user N provider N provider N+1 user
Request Ind i c at i o n
R e s p o n
s e
C o n f i r m
System A System B
Connectionless & Connection-
Oriented Services
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 88/172
• Connection-Oriented
– Three-phases:
1. Connection setup
between two SAPs
to initialize state
information2. SDU transfer
3. Connection release
– E.g. TCP, ATM
• Connectionless
– Immediate SDU
transfer – No connection setup
– E.g. UDP, IP
• Layered servicesneed not be of sametype
– TCP operates over IP – IP operates over ATM
Segmentation & Reassembly
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 89/172
• A layer may impose alimit on the size of a datablock that it can transfer for implementation or other reasons
• Thus a layer-n SDU may
be too large to behandled as a single unitby layer-(n-1)
• Sender side: SDU issegmented into multiplePDUs
• Receiver side: SDU is
reassembled fromsequence of PDUs
n-SDU
n-PDU n-PDU n-PDU
Segmentation(a)
Reassembly(b)
n-PDU
n-SDU
n-PDU n-PDU
Multiplexing
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 90/172
• Sharing of layer n service by multiple layer n+1 users
• Multiplexing tag or ID required in each PDU to determine
which users an SDU belongs to
n+1entity
n+1entity
n+1entity
n+1entity
n entity n entity
n-SDUn-SDU
n-SDUH
Hn-SDU
n-PDU
Summary
Layers: related communications functions
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 91/172
• Layers: related communications functions – Application Layer: HTTP, DNS
– Transport Layer: TCP, UDP
– Network Layer: IP• Services: a protocol provides a communicationsservice to the layer above – TCP provides connection-oriented reliable byte transfer
service – UDP provides best-effort datagram service
• Each layer builds on services of lower layers
– HTTP builds on top of TCP – DNS builds on top of UDP
– TCP and UDP build on top of IP
Summary of duties
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 92/172
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 93/172
Applications and LayeredArchitectures
TCP/IP Architecture
How the Layers Work Together
Why Internetworking?
• To build a “network of networks” or internet
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 94/172
• To build a network of networks or internet – operating over multiple, coexisting, different network
technologies
– providing ubiquitous connectivity through IP packettransfer
– achieving huge economies of scale
G
G
G
GG
G
H
Net 5Net 5
HNet 5Net 2
H
Net 5Net 3H
Net 5Net 1
Net 5Net 4
Why Internetworking?
• To provide universal communication services
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 95/172
• To provide universal communication services – independent of underlying network technologies
– providing common interface to user applications
G
G
G
GG
G
H
Net 5Net 5
HNet 5Net 2
H
Net 5Net 3H
Net 5Net 1
Net 5Net 4
Reliable Stream Service
User Datagram Service
Why Internetworking?
• To provide distributed applications
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 96/172
• To provide distributed applications – Any application designed to operate based on Internet
communication services immediately operates across
the entire Internet – Rapid deployment of new applications
• Email, WWW, Peer-to-peer
– Applications independent of network technology• New networks can be introduced below
• Old network technologies can be retired
Internet Protocol Approach IP packets transfer information across Internet
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 97/172
IP packets transfer information across InternetHost A IP → router → router…→ router → Host B IP
IP layer in each router determines next hop (router)
Network interfaces transfer IP packets across networks
Router
InternetLayer
Network
Interface
TransportLayer
Internet
Layer
Network
Interface
TransportLayer
Internet
Layer
Network
Interface
Host A Host B
Net 5Net 1
Net 5Net 2 Net 5Net 3
Router
Internet
Layer
NetworkInterface
Router
Internet
Layer
Network
Interface
Net 5Net 4
TCP/IP Protocol Suite
Distributed
HTTP SMTP RTPDNS
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 98/172
Reliable
streamservice
Distributedapplications User
datagramservice
(ICMP, ARP)
TCP UDP
IP
Network
interface 1
Network
interface 3
Network
interface 2
Best-effortconnectionlesspacket transfer
Diverse network technologies
Internet Names & Addresses
I t t N Internet Addresses
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 99/172
Internet Names• Each host a a unique name
– Independent of physicallocation
– Facilitate memorization byhumans
– Domain Name
– Organization under singleadministrative unit
• Host Name
– Name given to host computer
• User Name
– Name assigned to user
Internet Addresses
• Each host has globally uniquelogical 32 bit IP address
• Separate address for eachphysical connection to anetwork
• Routing decision is done
based on destination IPaddress
• IP address has two parts:
– netid and hostid – netid unique
– netid facilitates routing
• Dotted Decimal Notation:
int1.int2.int3.int4DNS resolves IP name to IP address
Physical Addresses
LAN ( d th t k ) i h i l
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 100/172
• LANs (and other networks) assign physicaladdresses to the physical attachment to the
network• The network uses its own address to transfer
packets or frames to the appropriate destination
• IP address needs to be resolved to physicaladdress at each IP network interface
• Example: Ethernet uses 48-bit addresses
– Each Ethernet network interface card (NIC) hasglobally unique Medium Access Control (MAC) or physical address
– First 24 bits identify NIC manufacturer; second 24 bitsare serial number
Intel
Example internet
(2 1)
PCServer
Router
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 101/172
(1,1) s
(2,1)
(1,3) r (2,2)PPP
Netid=2w
Ethernet(netid=1)
*PPP does not use addressesWorkstation
(1,2)
netid hostidPhysical
address
router 2 1 -
PC 2 2 -
server 1 1 s
workstation 1 2 w
router 1 3 r
Encapsulation
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 102/172
IP
header IP Payload
Ethernetheader FCSIP
header IP Payload
Ethernet header contains: source and destination physical addresses
network protocol type (e.g. IP)
IP packet from workstation to
server PCServer
Router
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 103/172
(1,1) s
w
(2,1)
(1,3) r (2,2)PPP
Ethernet
Router
(1,2), (1,1)w, s
Workstation
(1,2)
1. IP packet has (1,2) IP address for source and (1,1) IP address for destination
2. IP table at workstation indicates (1,1) connected to same network, so IP
packet is encapsulated in Ethernet frame with addresses w and s3. Ethernet frame is broadcast by workstation NIC and captured by server
NIC
4. NIC examines protocol type field and then delivers packet to its IP layer
IP packet from server to PC
(2 1)
PCServer Router
(1 1) (2 2)
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 104/172
(1,1) s
w
(2,1)
(1,3) r
(1,1), (2,2)s, r
(1,1), (2,2)
(2,2)
Workstation
(1,2)
1. IP packet has (1,1) and (2,2) as IP source and destination addresses
2. IP table at server indicates packet should be sent to router, so IP packetis encapsulated in Ethernet frame with addresses s and r
3. Ethernet frame is broadcast by server NIC and captured by router NIC
4. NIC examines protocol type field and then delivers packet to its IP layer
5. IP layer examines IP packet destination address and determines IPpacket should be routed to (2,2)
6. Router’s table indicates (2,2) is directly connected via PPP link
7. IP packet is encapsulated in PPP frame and delivered to PC
8. PPP at PC examines rotocol t e field and delivers acket to PC IP
How the layers work together PCServer
Router(a)
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 105/172
(1,1) s
(2,1)
(1,3) r (2,2)PPP
Router
Ethernet
Server (b)
Network interface
IP
TCP
HTTP
Network interface
IP
Network interface
IP
TCP
HTTP
Ethernet PPPRouter
PC
TCP uses node-to-node
Unreliable packet transfer of IP
Server IP address & PC IP address
Internet
HTTP uses process-to-process
Reliable byte stream transfer of
TCP connection:
Server socket: (IP Address, 80)
PC socket (IP Address, Eph. #)
Encapsulation
TCP Header contains
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 106/172
source & destination
port numbers
IP Header contains
source and destination
IP addresses;
transport protocol type
Ethernet Header contains
source & destination MAC
addresses;network protocol type
HTTP Request
TCP
header HTTP Request
IP
header
TCP
header HTTP Request
Ethernet
header
IP
header
TCP
header HTTP Request FCS
How the layers work together:Network Analyzer Example
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 107/172
Internet
• User clicks on http://www.nytimes.com/• Ethereal network analyzer captures all frames
observed by its Ethernet NIC
• Sequence of frames and contents of frame canbe examined in detail down to individual bytes
Ethereal windows
Top Pane
shows
frame/packet
sequence
Middle Pane
shows
encapsulation for a given frame
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 108/172
q a given frame
Bottom Pane shows hex & text
Top pane: frame sequence
DNSQuery
TCP
ConnectionSetup
HTTP
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 109/172
Query SetupRequest &
Response
Middle pane: Encapsulation
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 110/172
Ethernet Frame
EthernetDestination and
Source
Addresses
Protocol Type
Middle pane: Encapsulation
And a lot of
other stuff!
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 111/172
IP Packet
IP Source and
Destination
Addresses
Protocol Type
Middle pane: Encapsulation
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 112/172
TCP Segment
Source and
Destination PortNumbers
HTTP
Request
GET
Summary
• Encapsulation is key to layering
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 113/172
Encapsulation is key to layering
• IP provides for transfer of packets across
diverse networks
• TCP and UDP provide universal
communications services across the Internet
• Distributed applications that use TCP and UDP
can operate over the entire Internet
• Internet names, IP addresses, port numbers,sockets, connections, physical addresses
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 114/172
Applications and LayeredArchitectures
Sockets
Socket API
• API (Application Programming Interface)P id t d d t f f ti th t b ll d
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 115/172
– Provides a standard set of functions that can be calledby applications
• Berkeley UNIX Sockets API – Abstraction for applications to send & receive data
– Applications create sockets that “plug into” network
– Applications write/read to/from sockets
– Implemented in the kernel
– Facilitates development of network applications
– Hides details of underlying protocols & mechanisms
• Also in Windows, Linux, and other OS’s
Communications through Socket
InterfaceClient Server
A li ti 1Socket A li ti 2Socket
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 116/172
descriptor descriptor
• Application references a
socket through a descriptor • Socket bound to a port number port number port number
Application 1
Socket
Socket
interface
User
Kernel
Application 2
User
Kernel
Underlying
communication
protocols
Underlying
communication
protocols
Communications
network
Socket
Socket
interface
Stream mode of service
Connection-oriented • Connectionless
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 117/172
• First, setup connectionbetween two peer application processes
• Then, reliablebidirectional in-sequence
transfer of byte stream(boundaries notpreserved in transfer)
• Multiple write/readbetween peer processes
• Finally, connectionrelease
• Uses TCP
• Immediate transfer of oneblock of information(boundaries preserved)
• No setup overhead &delay
• Destination address witheach block
• Send/receive to/from
multiple peer processes• Best-effort service only
– Possible out-of-order
– Possible loss• Uses UDP
Client & Server Differences
• Server
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 118/172
– Specifies well-known port # when creating socket
– May have multiple IP addresses (net interfaces) – Waits passively for client requests
• Client
– Assigned ephemeral port #
– Initiates communications with server
– Needs to know server’s IP address & port #• DNS for URL & server well-known port #
– Server learns client’s address & port #
Socket Calls for Connection-
Oriented Mode
Server Server does Passive Open socket creates socket to listen for connection
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 119/172
socket()
socket()
bind()
read()
close()
Data
Data
Clientlisten()
accept()
Blocks
write()
connect()
Connect
negotiation
write()
read()
soc et c eates soc et to ste o co ect orequests
Server specifies type: TCP (stream)
socket call returns: non-negative integer descriptor ;or -1 if unsuccessful
close()
Socket Calls for Connection-
Oriented Mode
Server Server does Passive Open bind assigns local address & port # to socket with
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 120/172
socket()
socket()
bind()
read()
close()
Data
Data
Clientlisten()
accept()
Blocks
write()
connect()
Connect
negotiation
write()
read()
g pspecified descriptor
Can wildcard IP address for multiple net interfaces
bind call returns: 0 (success); or -1 (failure)
Failure if port # already in use or if reuse option notset
close()
Socket Calls for Connection-Oriented Mode
Server Server does Passive Open listen indicates to TCP readiness to receive
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 121/172
socket()
socket()
bind()
read()
close()
Data
Data
Clientlisten()
accept()
Blocks
write()
connect()
Connect
negotiation
write()
read()
connection requests for socket with given descriptor
Parameter specifies max number of requests that maybe queued while waiting for server to accept them
listen call returns: 0 (success); or -1 (failure)
close()
Socket Calls for Connection-Oriented Mode
Server Server does Passive Open Server calls accept to accept incoming requests
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 122/172
socket()
socket()
bind()
read()
close()
Data
Data
Clientlisten()
accept()
Blocks
write()
connect()
Connect
negotiation
write()
read()
accept blocks if queue is empty
close()
Socket Calls for Connection-Oriented Mode
Server Client does Active Open socket creates socket to connect to server
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 123/172
socket()
socket()
bind()
read()
close()
Data
Data
Clientlisten()
accept()
Blocks
write()
connect()
Connect
negotiation
write()
read()
close()
Client specifies type: TCP (stream)
socket call returns: non-negative integer descriptor ;or -1 if unsuccessful
Socket Calls for Connection-Oriented Mode
Server Client does Active Open connect establishes a connection on the local socket
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 124/172
socket()
socket()
bind()
read()
close()
Data
Data
Clientlisten()
accept()
Blocks
write()
connect()
Connect
negotiation
write()
read()
close()
with the specified descriptor to the specified remoteaddress and port #
connect returns 0 if successful; -1 if unsuccessful
Note: connect
initiates TCP three-way
handshake
Socket Calls for Connection-Oriented Mode
Server accept wakes with incoming connection request accept fills client address & port # into address structure
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 125/172
socket()
socket()
bind()
read()
close()
Data
Data
Client
listen()
accept()
Blocks
write()
connect()
Connect
negotiation
write()
read()
accept call returns: descriptor of new connection socket (success); or -1 (failure)
Client & server use new socket for data transfer
Original socket continues to listen for new requests
close()
Socket Calls for Connection-Oriented Mode
Server Data Transfer Client or server call write to transmit data into a
t d k t
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 126/172
socket()
socket()
bind()
read()
close()
Data
Data
Client
listen()
accept()
Blocks
write()
connect()
Connect
negotiation
write()
read()
connected socket
write specifies: socket descriptor; pointer to a buffer;
amount of data; flags to control transmission behavior write call returns: # bytes transferred (success); or -1
(failure); blocks until all data transferred
close()
Socket Calls for Connection-Oriented Mode
Server Data Transfer Client or server call read to receive data from a
t d k t
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 127/172
socket()
socket()
bind()
read()
close()
Data
Data
Client
listen()
accept()
Blocks
write()
connect()
Connect
negotiation
write()
read()
connected socket
read specifies: socket descriptor; pointer to a buffer;
amount of data read call returns: # bytes read (success); or -1 (failure);
blocks if no data arrives
close()
Note: write and read
can be called multiple
times to transfer byte
streams in bothdirections
Socket Calls for Connection-Oriented Mode
Server Connection Termination Client or server call close when socket is no longer
needed
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 128/172
socket()
socket()
bind()
read()
close()
Data
Data
Client
listen()
accept()
Blocks
write()
connect()
Connect
negotiation
write()
read()
needed
close specifies the socket descriptor
close call returns: 0 (success); or -1 (failure)
Note: close initiates
TCP graceful close
sequence
close()
Example: TCP Echo Server /* Bind an address to the socket */
bzero((char *)&server, sizeof(struct sockaddr_in));
server.sin_family = AF_INET;
server.sin_port = htons(port);
server.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind(sd, (struct sockaddr *)&server,
i
/* A simple echo server using TCP */
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 129/172
sizeof(server)) == -1) {
fprintf(stderr, "Can't bind name to socket\n");
exit(1);
}
/* queue up to 5 connect requests */
listen(sd, 5);
while (1) {
client_len = sizeof(client);
if ((new_sd = accept(sd, (struct sockaddr *)&client,
&client_len)) == -1) {
fprintf(stderr, "Can't accept client\n");
exit(1);
}
bp = buf;
bytes_to_read = BUFLEN;
while ((n = read(new_sd, bp, bytes_to_read)) > 0) {
bp += n;
bytes_to_read -= n;
}
printf("Rec'd: %s\n", buf);
write(new_sd, buf, BUFLEN);printf("Sent: %s\n", buf);
close(new_sd);
}
close(sd);
return(0);
}
#define SERVER_TCP_PORT 3000
#define BUFLEN 256
int main(int argc, char **argv)
{
int n, bytes_to_read;
int sd, new_sd, client_len, port;
struct sockaddr_in server, client;
char *bp, buf[BUFLEN];
switch(argc) {
case 1:
port = SERVER_TCP_PORT;
break;
case 2:port = atoi(argv[1]);
break;
default:
fprintf(stderr, "Usage: %s [port]\n", argv[0]);
exit(1);
}
/* Create a stream socket */
if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
fprintf(stderr, "Can't create a socket\n");exit(1);
}
Example: TCP Echo Client/* A simple TCP client */
#include <stdio.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
bzero((char *)&server, sizeof(struct sockaddr_in));server.sin_family = AF_INET;
server.sin_port = htons(port);
if ((hp = gethostbyname(host)) == NULL) {
fprintf(stderr, "Can't get server's address\n");
exit(1);
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 130/172
#define SERVER_TCP_PORT 3000
#define BUFLEN 256
int main(int argc, char **argv){
int n, bytes_to_read;
int sd, port;
struct hostent *hp;
struct sockaddr_in server;
char *host, *bp, rbuf[BUFLEN], sbuf[BUFLEN];
switch(argc) {
case 2:
host = argv[1];port = SERVER_TCP_PORT;
break;
case 3:
host = argv[1];
port = atoi(argv[2]);
break;
default:
fprintf(stderr, "Usage: %s host [port]\n", argv[0]);
exit(1);
}
/* Create a stream socket */
if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
fprintf(stderr, "Can't create a socket\n");
exit(1);
}
}
bcopy(hp->h_addr, (char *)&server.sin_addr, hp->h_length);
/* Connecting to the server */
if (connect(sd, (struct sockaddr *)&server,sizeof(server)) == -1) {
fprintf(stderr, "Can't connect\n");
exit(1);
}
printf("Connected: server's address is %s\n", hp->h_name);
printf("Transmit:\n");
gets(sbuf);
write(sd, sbuf, BUFLEN);
printf("Receive:\n");
bp = rbuf;
bytes_to_read = BUFLEN;
while ((n = read(sd, bp, bytes_to_read)) > 0) {
bp += n;
bytes_to_read -= n;
}
printf("%s\n", rbuf);
close(sd);return(0);
}
Socket Calls for Connection-LessMode
Server Server started socket creates socket of type UDP (datagram)
k t call returns: descriptor; or 1 if unsuccessful
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 131/172
socket()
sendto()
socket()
recvfrom()
Data
Client
bind()
Blocks until server
receives data from
client
recvfrom()
close()close()
Data
sendto()
socket call returns: descriptor ; or -1 if unsuccessful
bind assigns local address & port # to socket withspecified descriptor; Can wildcard IP address
Socket Calls for Connection-LessMode
Server
recvfrom copies bytes received in specified socketinto a specified location
recvfrom blocks until data arrives
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 132/172
socket()
sendto()
socket()
recvfrom()
Data
Client
bind()
Blocks until server
receives data from
client
recvfrom()
close()close()
Data
sendto()
recvfrom blocks until data arrives
Socket Calls for Connection-LessMode
Server Client started socket creates socket of type UDP (datagram)
socket call returns: descriptor; or 1 if unsuccessful
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 133/172
sendto()
socket()
sendto()
socket()
recvfrom()
Data
Client
bind()
Blocks until server
receives data from
client
recvfrom()
close()close()
Data
socket call returns: descriptor ; or -1 if unsuccessful
Socket Calls for Connection-LessMode
Server Client started sendto transfer bytes in buffer to specified socket
sendto specifies: socket descriptor; pointer to a
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 134/172
sendto()
socket()
sendto()
socket()
recvfrom()
Data
Client
bind()
Blocks until server
receives data from
client
recvfrom()
close()close()
Data
sendto specifies: socket descriptor; pointer to abuffer; amount of data; flags to control transmission
behavior; destination address & port #; length of destination address structure
sendto returns: # bytes sent; or -1 if unsuccessful
Socket Calls for Connection-LessMode
Server
recvfrom wakes when data arrives recvfrom specifies: socket descriptor; pointer to a
buffer to put data; max # bytes to put in buffer; control
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 135/172
socket()
sendto()
socket()
recvfrom()
Data
Client
bind()
Blocks until server
receives data from
client
recvfrom()
close()close()
Data
sendto()
buffer to put data; max # bytes to put in buffer; controlflags; copies: sender address & port #; length of
sender address structure recvfrom returns # bytes received or -1 (failure)
Note: receivefrom
returns data from atmost one send, i.e.
from one datagram
Socket Calls for Connection-LessMode
Server Socket Close Client or server call close when socket is no longer
needed
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 136/172
socket()
sendto()
socket()
recvfrom()
Data
Client
bind()
Blocks until server
receives data from
client
recvfrom()
close()close()
Data
sendto()
close specifies the socket descriptor
close call returns: 0 (success); or -1 (failure)
Example: UDP Echo Server
/* Echo server using UDP */
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
/* Bind an address to the socket */
bzero((char *)&server, sizeof(server));
server.sin_family = AF_INET;
server.sin_port = htons(port);
server.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind(sd, (struct sockaddr *)&server,
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 137/172
#define SERVER_UDP_PORT 5000
#define MAXLEN 4096
int main(int argc, char **argv){
int sd, client_len, port, n;
char buf[MAXLEN];
struct sockaddr_in server, client;
switch(argc) {
case 1:
port = SERVER_UDP_PORT;
break;
case 2:port = atoi(argv[1]);
break;
default:
fprintf(stderr, "Usage: %s [port]\n", argv[0]);
exit(1);
}
/* Create a datagram socket */
if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
fprintf(stderr, "Can't create a socket\n");exit(1);
}
if (bind(sd, (struct sockaddr )&server,
sizeof(server)) == -1) {
fprintf(stderr, "Can't bind name to socket\n");
exit(1);
}
while (1) {
client_len = sizeof(client);
if ((n = recvfrom(sd, buf, MAXLEN, 0,
(struct sockaddr *)&client, &client_len)) < 0) {
fprintf(stderr, "Can't receive datagram\n");
exit(1);
}
if (sendto(sd, buf, n, 0,(struct sockaddr *)&client, client_len) != n) {
fprintf(stderr, "Can't send datagram\n");
exit(1);
}
}
close(sd);
return(0);
}
Example: UDP Echo Client#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define SERVER_UDP_PORT 5000
#define MAXLEN 4096
#define DEFLEN 64
l d l ( i l 1 i l 2)
else {
fprintf(stderr,
"Usage: %s [-s data_size] host [port]\n", pname);
exit(1);
}
if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
fprintf(stderr, "Can't create a socket\n");
exit(1);
}
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 138/172
long delay(struct timeval t1, struct timeval t2)
{
long d;
d = (t2.tv_sec - t1.tv_sec) * 1000;
d += ((t2.tv_usec - t1.tv_usec + 500) / 1000);
return(d);
}
int main(int argc, char **argv)
{
int data_size = DEFLEN, port = SERVER_UDP_PORT;
int i, j, sd, server_len;
char *pname, *host, rbuf[MAXLEN], sbuf[MAXLEN];
struct hostent *hp;
struct sockaddr_in server;struct timeval start, end;
unsigned long address;
pname = argv[0];
argc--;
argv++;
if (argc > 0 && (strcmp(*argv, "-s") == 0)) {
if (--argc > 0 && (data_size = atoi(*++argv))) {
argc--;
argv++;}
else {
fprintf(stderr,
"Usage: %s [-s data_size] host [port]\n", pname);
exit(1);
}
}
if (argc > 0) {
host = *argv;
if (--argc > 0)port = atoi(*++argv);
}
}
bzero((char *)&server, sizeof(server));
server.sin_family = AF_INET;
server.sin_port = htons(port);
if ((hp = gethostbyname(host)) == NULL) {
fprintf(stderr, "Can't get server's IP address\n");
exit(1);
}
bcopy(hp->h_addr, (char *) &server.sin_addr, hp->h_length);
if (data_size > MAXLEN) {
fprintf(stderr, "Data is too big\n");
exit(1);
}for (i = 0; i < data_size; i++) {
j = (i < 26) ? i : i % 26;
sbuf[i] = 'a' + j;
}
gettimeofday(&start, NULL); /* start delay measurement */
server_len = sizeof(server);
if (sendto(sd, sbuf, data_size, 0, (struct sockaddr *)
&server, server_len) == -1) {
fprintf(stderr, "sendto error\n");
exit(1);}
if (recvfrom(sd, rbuf, MAXLEN, 0, (struct sockaddr *)
&server, &server_len) < 0) {
fprintf(stderr, "recvfrom error\n");
exit(1);
}
gettimeofday(&end, NULL); /* end delay measurement */
if (strncmp(sbuf, rbuf, data_size) != 0)
printf("Data is corrupted\n");
close(sd);return(0);
}
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 139/172
Applications and LayeredArchitectures
Application Layer Protocols &IP Utilities
Telnet (RFC 854)
• Provides general bi-directional byte-orientedTCP-based communications facility (Network
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 140/172
Virtual Terminal)
• Initiating machine treated as local to the remote
host
• Used to connect to port # of other servers and tointeract with them using command line
NVTNVT
Server
process
Network Virtual Terminal
• Network Virtual Terminal
• Lowest common denominator terminal
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 141/172
• Lowest common denominator terminal
• Each machine maps characteristics to NVT
• Negotiate options for changes to the NVT
• Data input sent to server & echoed back• Server control functions : interrupt, abort output,
are-you-there, erase character, erase line
• Default requires login & password
telnet
• A program that uses the Telnet protocol
• Establishes TCP socket
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 142/172
• Establishes TCP socket
• Sends typed characters to server
• Prints whatever characters arrive
• Try it to retrieve a web page (HTTP) or to
send an email (SMTP)
File Transfer Protocol (RFC 959)
• Provides for transfer of file from one machine toanother machine
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 143/172
• Designed to hide variations in file storage• FTP parameter commands specify file info
– File Type: ASCII , EBCDIC, image, local.
– Data Structure: file, record, or page – Transmission Mode: stream, block, compressed
• Other FTP commands
– Access Control: USER, PASS, CWD, QUIT, … – Service: RETR, STOR, PWD, LIST, …
FTP File Transfer
User
interface
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 144/172
User PI
User DTP
PI = Protocol interface
DTP = Data transfer process
User FTP
Server PI
Server DTP
Server FTP
Control
connection
Data
connection
Two TCP Connections
Control connection – Set up using Telnet
protocol on well-known port
Data connection – To perform file transfer,
obtain lists of files
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 145/172
protocol on well known port
21 – FTP commands & replies
between protocol
interpreters
– PIs control the data transfer
process
– User requests close of
control connection; server performs the close
obtain lists of files,
directories – Each transfer requires
new data connection
– Passive open by user PIwith ephemeral port #
– Port # sent over controlconnection
– Active open by server using port 20
FTP RepliesReply Meaning
1yz Positive preliminary reply (action has begun, but wait for another reply before
sending a new command).
2yz Positive completion reply (action completed successfully; new command may be
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 146/172
sent).
3yz Positive intermediary reply (command accepted, but action cannot be performed
without additional information; user should send a command with the
necessary information).
4yz Transient negative completion reply (action currently cannot be performed;
resend command later).5zy Permanent negative completion reply (action cannot be performed; do not
resend it).x0z Syntax errors.
x1z Information (replies to requests for status or help).
x2z Connections (replies referring to the control and data connections).
x3z Authentication and accounting (replies for the login process and accounting
procedures).
x4z Unspecified.
x5z File system status.
FTP Client (192.168.1.132: 1421) establishesControl Connection to FTP Server
(128.100.132.23: 21)
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 147/172
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 148/172
.
in control connection (frame 47 request); Filetransfer on new data connection (port 1423, fr.
48, 49, 51)
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 149/172
Hypertext Transfer Protocol
• RFC 1945 (HTTP 1.0), RFC 2616 (HTTP 1.1)
• HTTP provides communications between web
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 150/172
p
browsers & web servers• Web: framework for accessing documents &
resources through the Internet
• Hypertext documents: text, graphics, images,
hyperlinks
• Documents prepared using Hypertext MarkupLanguage (HTML)
HTTP Protocol
• HTTP servers use well-known port 80
• Client request / Server reply
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 151/172
Client request / Server reply
• Stateless: server does not keep any
information about client
• HTTP 1.0 new TCP connection per request/reply (non-persistent)
• HTTP 1.1 persistent operation is default
HTTP Typical Exchange
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 152/172
HTTP Message Formats
• HTTP messages written in ASCII text
• Request Message Format
R t Li (E h li d ith i t )
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 153/172
– Request Line (Each line ends with carriage return)
• Method URL HTTP-Version \r\n
• Method specifies action to apply to object
• URL specifies object
– Header Lines (Ea. line ends with carriage return)
• Attribute Name: Attribute Value
• E.g. type of client, content, identity of requester, …
• Last header line has extra carriage return)
– Entity Body (Content)
• Additional information to server
HTTP Request Methods
Requestmethod
Meaning
GET Retrieve information (object) identified by the URL.
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 154/172
HEAD Retrieve meta-information about the object, but do nottransfer the object; Can be used to find out if a document
has changed.
POST Send information to a URL (using the entity body) and retrieve
result; used when a user fills out a form in a browser.
PUT Store information in location named by URL
DELETE Remove object identified by URL
TRACE Trace HTTP forwarding through proxies, tunnels, etc.
OPTIONS Used to determine the capabilities of the server, or
characteristics of a named resource.
Universal Resource Locator
• Absolute URL
– scheme://hostname[:port]/path
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 155/172
– http://www.nytimes.com/
• Relative URL
– /path
– /
HTTP Request Message
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 156/172
HTTP Response Message
• Response Message Format
– Status Line
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 157/172
• HTTP-Version Status-Code Message• Status Code: 3-digit code indicating result
• E.g. HTTP/1.0 200 OK
– Headers Section• Information about object transferred to client
• E.g. server type, content length, content type, …
– Content • Object (document)
HTTP Response Message
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 158/172
HTTP Proxy Server & Caching
• Web users generate large traffic volumes• Traffic causes congestion & delay
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 159/172
• Can improve delay performance and reducetraffic in Internet by moving content to servers
closer to the user
• Web proxy servers cache web information – Deployed by ISPs
– Customer browsers configured to first access ISPs
proxy servers
– Proxy replies immediately when it has requested
object or retrieves the object if it does not
Cookies and Web Sessions
• Cookies are data exchanged by clients &servers as header lines
• Since HTTP stateless, cookies can provide
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 160/172
context for HTTP interaction• Set cookie header line in reply message from
server + unique ID number for client
• If client accepts cookie, cookie added to client’scookie file (must include expiration date)
• Henceforth client requests include ID• Server site can track client interactions, storethese in a separate database, and access
database to prepare appropriate responses
Cookie Header Line;ID is 24 hexadecimal numeral
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 161/172
PING
• Application to determine if host is reachable
• Based on Internet Control Message Protocol
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 162/172
– ICMP informs source host about errors encountered inIP packet processing by routers or by destination host
– ICMP Echo message requests reply from destination
host• PING sends echo message & sequence #
• Determines reachability & round-trip delay
• Sometimes disabled for security reasons
PING from NAL host
Microsoft(R) Windows DOS(c)Copyright Microsoft Corp 1990-2001.
C:\DOCUME~1\1>ping nal.toronto.edu
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 163/172
Pinging nal.toronto.edu [128.100.244.3] with 32 bytes of data:
Reply from 128.100.244.3: bytes=32 time=84ms TTL=240Reply from 128.100.244.3: bytes=32 time=110ms TTL=240Reply from 128.100.244.3: bytes=32 time=81ms TTL=240Reply from 128.100.244.3: bytes=32 time=79ms TTL=240
Ping statistics for 128.100.244.3:Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds: Minimum = 79ms, Maximum = 110ms, Average = 88ms
C:\DOCUME~
1\1>
Traceroute
• Find route from local host to a remote host
• Time-to-Live (TTL)– IP packets have TTL field that specifies maximum #
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 164/172
IP packets have TTL field that specifies maximum #hops traversed before packet discarded
– Each router decrements TTL by 1
– When TTL reaches 0 packet is discarded
• Traceroute – Send UDP to remote host with TTL=1
– First router will reply ICMP Time Exceeded Msg – Send UDP to remote host with TTL=2, …
– Each step reveals next router in path to remote host
Traceroute from home PC touniversity host
Tracing route to www.comm.utoronto.ca [128.100.11.60]
over a maximum of 30 hops:
1 1 ms <10 ms <10 ms 192.168.2.1
2 3 ms 3 ms 3 ms 10.202.128.1
3 4 ms 3 ms 3 ms gw04.ym.phub.net.cable.rogers.com [66.185.83.142]
4 * * * Request timed out.
Home Network
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 165/172
4 Request timed out.
5 47 ms 59 ms 66 ms gw01.bloor.phub.net.cable.rogers.com [66.185.80.230]
6 3 ms 3 ms 38 ms gw02.bloor.phub.net.cable.rogers.com [66.185.80.242]
7 8 ms 3 ms 5 ms gw01.wlfdle.phub.net.cable.rogers.com [66.185.80.2]
8 8 ms 7 ms 7 ms gw02.wlfdle.phub.net.cable.rogers.com [66.185.80.142]
9 4 ms 10 ms 4 ms gw01.front.phub.net.cable.rogers.com [66.185.81.18]
10 6 ms 4 ms 5 ms ra1sh-ge3-4.mt.bigpipeinc.com [66.244.223.237]11 16 ms 17 ms 13 ms rx0sh-hydro-one-telecom.mt.bigpipeinc.com [66.244.223.246]
12 7 ms 14 ms 8 ms 142.46.4.2
13 10 ms 7 ms 6 ms utorgw.onet.on.ca [206.248.221.6]
14 7 ms 6 ms 11 ms mcl-gateway.gw.utoronto.ca [128.100.96.101]
15 7 ms 5 ms 8 ms sf-gpb.gw.utoronto.ca [128.100.96.17]
16 7 ms 7 ms 10 ms bi15000.ece.utoronto.ca [128.100.96.236]
17 7 ms 9 ms 9 ms www.comm.utoronto.ca [128.100.11.60]
Trace complete.
Rogers Cable
ISP
Ontario Net
University of
Toronto
Hydro OneShaw Net
ipconfig
• Utility in Microsoft® Windows to display
TCP/IP information about a host
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 166/172
• Many options – Simplest: IP address, subnet mask, default
gateway for the host – Information about each IP interface of a host
• DNS hostname, IP addresses of DNS servers,
physical address of network card, IP address, …
– Renew IP address from DHCP server
netstat
• Queries a host about TCP/IP network
status
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 167/172
• Status of network drivers & their interfacecards
– #packets in, #packets out, errored packets, …• State of routing table in host
• TCP/IP active server processes• TCP active connections
netstat protocol statistics
IPv4 Statistics
Packets Received = 71271
Received Header Errors = 0
Received Address Errors = 9
Datagrams Forwarded = 0
Unknown Protocols Received = 0
ICMPv4 Statistics
Received Sent
Messages 10 6
Errors 0 0
Destination Unreachable 8 1
Time Exceeded 0 0
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 168/172
Received Packets Discarded = 0
Received Packets Delivered = 71271
Output Requests = 70138
Routing Discards = 0
Discarded Output Packets = 0
Output Packet No Route = 0
Reassembly Required = 0Reassembly Successful = 0
Reassembly Failures = 0
Datagrams Successfully Fragmented = 0
Datagrams Failing Fragmentation = 0
Fragments Created = 0
UDP Statistics for IPv4
Datagrams Received = 6810
No Ports = 15
Receive Errors = 0
Datagrams Sent = 6309
Parameter Problems 0 0
Source Quenches 0 0
Redirects 0 0
Echos 0 2
Echo Replies 2 0
Timestamps 0 0
Timestamp Replies 0 0Address Masks 0 0
Address Mask Replies 0 0
TCP Statistics for IPv4
Active Opens = 798
Passive Opens = 17Failed Connection Attempts = 13
Reset Connections = 467
Current Connections = 0
Segments Received = 64443
Segments Sent = 63724
Segments Retransmitted = 80
tcpdump and Network ProtocolAnalyzers
• tcpdump program captures IP packets on anetwork interface (usually Ethernet NIC)
• Filtering used to select packets of interest
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 169/172
• Packets & higher-layer messages can bedisplayed and analyzed
• tcpdump basis for many network protocolanalyzers for troubleshooting networks
• We use the open source Ethereal analyzer to
generate examples – www.ethereal.com
Standards
• New technologies very costly and risky
• Standards allow players to share risk andbenefits of a new market
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 170/172
– Reduced cost of entry
– Interoperability and network effect
– Compete on innovation
– Completing the value chain• Chips, systems, equipment vendors, service providers
• Example – 802.11 wireless LAN products
Standards Bodies
• Internet Engineering Task Force – Internet standards development
– Request for Comments (RFCs): www.ietf.org
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 171/172
• International Telecommunications Union – International telecom standards
• IEEE 802 Committee – Local area and metropolitan area network standards
• Industry Organizations
– MPLS Forum, WiFi Alliance, World Wide WebConsortium
A humorous illustration of aprotocol stack as depicted by
various
d d i i
8/14/2019 Unit1- Data Communication
http://slidepdf.com/reader/full/unit1-data-communication 172/172
standards organizations.