Computer networks Homework Assignment 1
Due Oct. 7, 2012 Mailbox: comnethomework11@163.com
Problem 1
1. Design and describe an application-level protocol to be used between an automatic
teller machine and a bank’s centralized computer. You protocol should allow a user’s
card and password to be verified, the account balance (which is maintained at the
centralized computer) to be queried, and an account withdrawal to be made (that is,
money disbursed to the user). Your protocol entities should be able to handle the
all-too-common case in which there is not enough money in the account to cover the
withdrawal. Specify your protocol by listing the messages exchanged and the action
taken by the automatic teller machine or the bank’s centralized computer on
transmission and receipt of messages. Sketch the operation of your protocol for the
case of a simple withdrawal with no errors, using a diagram similar to that in Figure
1.2. Explicitly state the assumption made by your protocol about underlying
end-to-end transport service.
(1)first ,we should define the message between client and server :
A: message from client to server:
USERID : to let server know whether the user exist;
PASSWORD: to let put into password,to obtain the right to enter;
BALANCE :client requests balance
WITHDRAWL(amount) :client asks to withdraw money ,the number is amount;
BYE: client leaves;
B: message from server to client:
PASSWORD : ask client for password;
OK : give the right to operate withdrawl;
ERROR:not give the right to operate withdrawl;
SUM: show the balance to client;
BYE : the operation is over;
the correct operation :
Client
Server
(2)
USERID
PASSWORD
BALANCE
----------->
<------------
------------->
<-------------
------------->
<--------------
WITHDRAWL(amount) -------->
BYE
<-------------
---------------->
<-------------
check the USERID is valid
If valid ,then PASSWORD;
check whether password is correct ,
If correct ,OK
SUM
check if enough money to cover withdrawl
OK
BYE
(3) when has’t enough money:
Client
USERID
PASSWORD
BALANCE
------------->
<------------
-------------->
<--------------
-------------->
<--------------
Server
check the USERID is valid
If valid ,then PASSWORD;
check whether the passeord correct ,
If correct ,OK
SUM
WITHDRAWL(amount) --------->
BYE
<---------------
---------------->
<---------------
check if enough $ to cover withdrawl
ERROR (not enough money)
BYE
Problem 5
Consider sending a packet of F bits over a path of Q links. Each link transmits at R
bps. The network is lightly loaded so that there are no queuing delays. Propagation
delay is negligible.
a. Suppose the network is a packet-switched virtual circuit network. Denote the VC
set-up time by ts seconds. Suppose the sending layers add a total of h bits of
header to each packet. How long does it take to send the file from source to
destination?
t+((h+F)/R)*Q
b. Suppose the network is a packet-switched datagram network and a connectionless
service is used. Now suppose each packet has 2h bits of header. How long does it
take to send the file?
((2h+F)/R)*Q
c. Finally, suppose that the network is a circuit-switched network. Further suppose
that the transmission rate of the circuit between source and destination is R bps.
Assuming ts set-up time and h bits of header appended to the entire file, how long
does it take to send the file?
t + (h+F)/R
Problem6
This elementary problem begins to explore propagation delay and transmission delay,
two central concepts in data networking. Consider two hosts, Host A and B,
connected by a single link of rate R bps. Suppose that the two hosts are separated by
m meters, and suppose the propagation speed along the link is s meters/sec. Host
A is to send a packet of size L bits to Host B.
a. Express the propagation delay, dprop in terms of m and s.
b. Determine the transmission time of the packet, dtrans in terms of L and R.
dprop = m/s
dtrans = L/R
c.
Ignoring processing and queuing delays, obtain an expression for the end-to-end
delay.
d. Suppose Host A begins to transmit the packet at time t = 0. At time t = dtrans,
dprop + dtrans = m/s + L/R
where is the last bit of the packet?
At the host A
e. Suppose dprop is greater than dtrans. At time t = dtrans, where is the first bit of
(L/R)*s from the A ,
on the chance between A and B
f. Suppose dprop is less than dtrans. At time t = dtrans, where is the first bit of the
the packet?
packet?
At the host B
g. Suppose s = 2.5*108, L = 100 bits, and R = 28 kbps. Find the distance m so that
dprop equals dtrans.
m/s = L/R => m = 892.9KM;
Problem7
In this problem we consider sending voice from Host A to Host B over a
packet-switched network (for example, Internet phone). Host A converts on-the-fly
analog voice to a digital 64- Kbps bit stream. Host A then groups the bits into 48-byte
packets. There is one link between host A and B; its transmission rate is 1 Mbps and
its propagation delay is 2 mesc. As soon as Host A gathers a packet, it sends it to Host
B. As soon as Host B receives an entire packet, it converts the packet’s bits to an
analog signal. How much time elapses from the time a bit is created (from the original
analog signal at A) until a bit is decoded (as part of the analog signal at B)?
Analog convert to Digital at host A time t1 = (48*8)/64*1000 = 6ms
Transmit time t2= (48*8)/1000000 = 0.384ms;
Dprop time t3= 2ms
Analog convert to Digital at host B time t4 = (48*8)/64*1000 = 6ms
Total time = t1 + t2 + t3 + t4 = 14.384ms;
Problem 10
Consider the queuing delay in a router buffer (preceding an outbound link). Suppose
all packets are L bits, the transmission rate is R bps, and that N packets arrive to the
buffer every LN/R seconds. Find the average queuing delay of a packet.
Because every LN/R s N packets arrives ,that we can analyse the N packets:
Suppose the N packets labels p1,p2…pn;
Before
Before
Before
.
.
Before
p1 sends ,it will delay 0s;
p2 sends,it will delay L/Rs;
p3 sends, it will delay 2*L/Rs;
pn sends, it will delay (N-1)*L/Rs;
So ,the average tiem = ((1+2+…(N-1))*(L/R))/Ns = ((N-1)*L)/(2*R)s
Problem 13
Perform a traceroute between source and destination on the same continent at three
different hours of the day.
a. Find the average and standard deviation of the round-trip delays at each of the
three hours.
Average delays = 3s
Yes
b. Find the number of routers in the path at each of the three hours. Did the paths
change during any of the hours?
b. Try to identify the number of ISP networks that the Traceroute packets pass
through from source to destination. Routers with similar names and/or similar IP
addresses should be considered as part of the same ISP. In your experiments, do
the largest delays occur at peering interfaces between adjacent ISPs?
No
d. Repeat the above for a source and destination on different continents. Compare the
intracontinent and intercontinent results.
Problem 14
Suppose two hosts, A and B, are separated by 10,000 kilometers and are connected by
a direct link of R = 1 Mbps. Suppose the propagation speed over the link is 2.5*
810 meters/sec.
a. Calculate the bandwidth-delay product, R*
t
prop
= 1Mbps
*(10000*1000)/2.5*100000000 = 40Kb;
b. Consider sending a file of 400,000 bits from Host A to Host B. Suppose the file is
sent continuously as one big message. What is the maximum number of bits that
will be in the link at any given time?
Dtrans = 400000/1000000 = 0.4s;
Dprops = 10000000/250000000 = 0.04s;
Because Dtrans > Dprops ,that the maximum number of bits = 0.04 * 1Mbps =
40Kb;
c. Provide an interpretation of the bandwidth-delay product.
We can conclude the anwer from the up two results, The anbandwidth-delay
product means the maximum number of bits that is in the link at given time.
d. What is the width (in meters) of a bit in the link? Is it longer than a football field?
Width = (1000000)/40000 = 250m,
It is longer than a football field
e. Derive a general expression for the width of a bit in terms of the propagation
speed s, the transmission rate R, and the length of the link m.
We can assume the packet length = L;
If(L/R>m/s) Total bits = R*(m/s); Width = m/(R*(m/s)) = s/R;
If(L/R<=m/s) Total bits = ((L/R)*s)/L = s/R;
So ,the width of bit is s/R;
Problem17
Refer again to problem 14.
a. How long does it take to send the file, assuming it is sent continuously?
Dtrans = 400000/1000000 = 0.4s;
Dprops = 10000000/250000000 = 0.04s;
So the time = Dtrans + Dprops = 0.44s;
b. Suppose now the file is broken up into 10 packets with each packet containing
20,000bits. Suppose that each packet is acknowledged by the receiver and the
transmission time of an acknowledgment packet is negligible. Finally, assume that
the sender cannot send a packet until the preceding one is acknowledged. How
long does it take to send the file?
Per
0.06s;
Per acknowledged time = 10000000/25000000 = 0.04s;
packet send time = 20000/1000000 + 10000000/25000000 = 0.02+0.04 =
So total time = (0.04+0.06)*10 = 1s;
c. Compare the results from (a) and (b).
When the file is broken up into several packets ,it takes more time to send it than
in a whole packet,the time cost including the acknowledge time ,while it's safer to use
smaller packets .
Problem 20
In modern packet-switched networks, the source host segments long, application-layer
messages (for examples, an image or a music file) into smaller packets and sends the
packets into the network. The receiver then reassembles the packets back into the
original message. We refer to this process as message segmentation. Figure 1.21
illustrates the end-to-end transport of a message with and without message
segmentation. Consider a message that is 7.5*10e6 bits long that is to be sent from
source to destination in Figure1.21. Suppose each link in the figure is 1.5Mbps.
Ignore propagation, queueing, and processing delays
a. Consider sending the message from source to destination without message
segmentation. How long does it take to move the message from source to
destination without message segmentation? How long does it take to move the
message from the source host to the first packet switch, what is the total time to
move the message from source host to destination host?
The time from host to the first switch = 7500000/1.5Mbps = 5s;
We assume the number of switch is N ,that the total time = 5*Ns;
If N = 3,the total time = 15s;
b. Now suppose that the message is segmented into 5,000 packets, with each packet
being 1,500 bits long. How long does it take to move the first packet from the
source host to the first packet switch? When the first packet is being sent from the
first switch to the second switch, the second packet is being sent from the source
host to the second switch. At what time will the second packet be fully received at
the first switch?
The time from host to the first switch = 1500/1.5Mbps = 0.001s;
The same ,it will take 0.001s for the second packet is being send from the host
to the first switch; so it takes 0.002s for the second packet being fully receiced
by the first switch;
c. How long does it take to move the file from source host to destination host when
message segmentation is used? Compare this result with your answer in a part (a)
and comment
Total time = 0.001*3 + 0.001*4999 = 5.002s
So when message is divided into more packets ,it takes less time to send;
d. Discuss the drawbacks of message segmentation.
First :the packets must in the right order;
Second: the message should be large;
Third : Ignore propagation, queueing, and processing delays
Problem 22
Consider sending a large file of F bits from Host A to Host B. There are two links
(and one switch) between A and B, and the links are uncongested (that is, no queuing
delays). Host A segments the file into segments of S bits each and adds 40 bits of
header to each segment, forming packets of L = 40 + S bits. Each link has a
transmission rate of R bps. Find the value of S that minimizes the delay of moving the
packet from Host A to Host B. Neglect propagation delay.
Total time =((40+S)/R)*2 + ((40+S)/R)*(F/S);
We can conclude that when S =sqrt(40F), the time is lest.