COMP 5416讲解、Python程序语言调试、辅导Python设计
- 首页 >> Java编程 COMP 5416 Assignment 1 (2020)
Due: 7/OCT/2020, 23:59pm, Sydney time
Question 1 (Delay, 18%). As shown in the figure below, a file of size F = 1000 + S bytes is transmitted on an end-to-end
connection over three links, where S is the last three digits of your student number. For example, if your student number is
490123456, then S = 456 and F = 1456 bytes.
Each link is 100 km. The signal prorogation speed is 2 × 108 m/s. Assume that a header of 40 bytes is added to each packet.
The bandwidth of all links is R = 1 Mbps at the beginning. The nodes use the store-and-forward scheme. (Ignore processing
delays at each node.)
(0) What is your student number? Warning: If you use another student’s number as S value to answer the question, the following
sub-questions will not be marked and you will get 0 in Question 1.
(1) How long does it take to transmit the file if the whole file is transmitted as a single packet.
Now assume that the bandwidth of link B − C becomes 0.5 Mbps. Answer (2)–(4).
(2) Repeat (1).
(3) We would like to break the file into smaller packets to decrease the overall delay in the store-and-forward scheme. Assume
that each time you break the file to make a new packet, you have to add 40 bytes as the header of the new packet. Repeat (2)
when we break the file into N = 4 packets.
(4) What should be the optimal size of the packets to have the minimum overall delay to deliver the whole file? Find the overall
delay.
Hint: Since the link B − C has a smaller bandwidth compared with A − B, packets could be queued for some time!
$ % & '
2
Question 2 (Equilibrium of Two Competing Transmissions, 18%). Consider the following scenario where two mobile phones
are competing to use the save channel (same scenario as Tutorial 1, Exercise 1).
The utilities are as follows. (The two users have different utilities when its transmission is successful). Mixed strategy is used.
User 1 transmits with probability p1 and user 2 with probability p2. p1 and p2 are non-zero.
(1) If the two users are selfish, compute the transmission probabilities of the two users at equilibrium. What are the utilities of
the two users at equilibrium?
(2) If the two users are cooperative and p1 = p2, compute the max average utility of two users, i.e., 0.5×average utility of user
1 + 0.5×average utility of user 2. What is the value of p1 (i.e., p2) when the average utility of two users is maximized?
3
Question 3 (P2P Performance, 18%). A P2P system is shown below. There are N peers in the system. us is the server upload
capacity. di and ui are the download and upload capacity of the ith peer. F is the size of the file to be distributed. Let F = 10×106
bits, us = 2 × 106 bps, for any user i, di = 2 × 105 bps and ui = 105 bps.
(1) What is the overall delay Dcs to distribute the file from the server to all peers if client-server mode is used? What is the
delay Dp2p if P2P mode is used? Draw a figure of Dcs and Dp2p under different N where N is from 1 to 50. Discuss Dcs and
Dp2p if N → ∞.
(2) Now we assume peers have different upload capacity.
bps for the ith peer. All other parameters are not changed.
Draw a figure of Dcs and Dp2p under different N where N is from 1 to 50. Discuss Dcs and Dp2p, if N → ∞.
Question 4 (P2P Tit-for-Tat, 18%). As shown in the figure below, A and B are communicating with their top-4 partners in a
BitTorrent system. A’s uploading and downloading data rates of the ith partner are ui and di respectively;They
are independent random variables, following uniform distribution in [0, 1] Mbps.
Now A optimistically unchoked B, with a sending data rate of rab. If A becomes a top-4 sender of B, B will start to serve A
with a sending data rate of rba. rab and rba are independent random variables, following uniform distribution in [0, 1] Mbps.
What is the probability that both A and B find each other a top-4 sender? Show your mathematical derivations.
Question 5 (Wireshark Experiment, 18%). In this task, you will run a Wireshark experiment. Please follow the following
procedure and answer questions.
Please note that you will need to connect to VPN if you are not on campus. Both FortiClient and Cisco AnyConnect are available.
You need to choose the correct interface in Wireshark indicating the VPN you are using. Otherwise, you cannot see the correct
packets captured.
1) Open a web browser. Clear the cache of the browser.
2) Start up the capture of Wireshark packet sniffer.
3) Enter the following URL into your browser.
http://wbserver.cs.usyd.edu.au/A1.html
4) Your browser should display text and an image.
5) When the image is completely loaded, enter the following URL into your browser
http://wbserver.cs.usyd.edu.au/A2.html
6) When the image is completely loaded, refresh your browser (e.g., press F5).
7) When the image is completely loaded, stop Wireshark packet capture.
Questions
(0) What is the time (date, hour, and minute) that you capture the packets? You will get 0 mark in Question 5 if you do not
provide the time.
(1) What is the IP address of the server that sends you the base web page?
(2) What is the IP address of the server that sends you the image?
(3) Is non-persistent HTTP or persistent HTTP employed? Why?
(4) What is the size of the image. How do you know that? You can only use the information provided by Wireshark capture.
(5) In step 3), your browser has downloaded the image for the first time. This image may or may not be re-downloaded again
in the following steps. In step 5), did you browser send the request for the image? If so, did the server send back the image to
your browser again? In step 6), did you browser send the request for the image? If so, did the server send back the image to
your browser again? (To answer these two questions, you should give screen-shots.)
(6) Now you need to have a close investigation of the image you have downloaded (when you download the image for the first
time). Locate the first four bytes of the image (.jpg file) in Wireshark. Screenshot the packet and location of the first four bytes
shown by Wireshark. Locate the last four bytes of the image (.jpg file) in Wireshark. Screenshot the packet and location of the
last four bytes shown in Wireshark.
To help you locate the bytes, you may consider to convert the original .jpg file into a byte-stream format. You may use the
following website https://www.onlinehexeditor.com/ to do so.
(7) Following (6), which one of the following statements is correct. Give your screenshots to justify your answer.
(a) The image is downloaded by a single packet.
(b) The image is downloaded by multiple packets and the last packet includes HTTP response (200 OK) and the last portion of
the image.
(c) The image is downloaded by multiple packets. The last packet includes the last portion of the image. Then, an HTTP response
(200 OK) is received in a separate packet.
6
Question 6 (Socket Programming, 10%). In this question, you are required to build a UDP client to the server using hostname
wbserver.cs.usyd.edu.au
and port number 12001. You client should be able to send a message to the server and receive a response message from the
server. The length of your message is limited to 100 characters. Your client must be in Python 3.
Still, please note that you will need to connect to VPN if you are not on campus. Both FortiClient and Cisco AnyConnect are
available. You need to choose the correct interface in Wireshark indicating the VPN you are using. Otherwise, you cannot see
the correct packets captured.
(0) What is the time (date, hour, and minute) that you complete this question? You will get 0 mark in Question 6 if you do not
provide the time.
(1) Send your student number (as a string encoded by utf-8) to the server and find the response message from the server.
(2) Use Wireshark to capture the response packet. Screenshot the packet.
(3) What is the IP address of the server? How does your computer know this IP address. Capture the packet that translates to
the IP address. Give your screenshot.
Due: 7/OCT/2020, 23:59pm, Sydney time
Question 1 (Delay, 18%). As shown in the figure below, a file of size F = 1000 + S bytes is transmitted on an end-to-end
connection over three links, where S is the last three digits of your student number. For example, if your student number is
490123456, then S = 456 and F = 1456 bytes.
Each link is 100 km. The signal prorogation speed is 2 × 108 m/s. Assume that a header of 40 bytes is added to each packet.
The bandwidth of all links is R = 1 Mbps at the beginning. The nodes use the store-and-forward scheme. (Ignore processing
delays at each node.)
(0) What is your student number? Warning: If you use another student’s number as S value to answer the question, the following
sub-questions will not be marked and you will get 0 in Question 1.
(1) How long does it take to transmit the file if the whole file is transmitted as a single packet.
Now assume that the bandwidth of link B − C becomes 0.5 Mbps. Answer (2)–(4).
(2) Repeat (1).
(3) We would like to break the file into smaller packets to decrease the overall delay in the store-and-forward scheme. Assume
that each time you break the file to make a new packet, you have to add 40 bytes as the header of the new packet. Repeat (2)
when we break the file into N = 4 packets.
(4) What should be the optimal size of the packets to have the minimum overall delay to deliver the whole file? Find the overall
delay.
Hint: Since the link B − C has a smaller bandwidth compared with A − B, packets could be queued for some time!
$ % & '
2
Question 2 (Equilibrium of Two Competing Transmissions, 18%). Consider the following scenario where two mobile phones
are competing to use the save channel (same scenario as Tutorial 1, Exercise 1).
The utilities are as follows. (The two users have different utilities when its transmission is successful). Mixed strategy is used.
User 1 transmits with probability p1 and user 2 with probability p2. p1 and p2 are non-zero.
(1) If the two users are selfish, compute the transmission probabilities of the two users at equilibrium. What are the utilities of
the two users at equilibrium?
(2) If the two users are cooperative and p1 = p2, compute the max average utility of two users, i.e., 0.5×average utility of user
1 + 0.5×average utility of user 2. What is the value of p1 (i.e., p2) when the average utility of two users is maximized?
3
Question 3 (P2P Performance, 18%). A P2P system is shown below. There are N peers in the system. us is the server upload
capacity. di and ui are the download and upload capacity of the ith peer. F is the size of the file to be distributed. Let F = 10×106
bits, us = 2 × 106 bps, for any user i, di = 2 × 105 bps and ui = 105 bps.
(1) What is the overall delay Dcs to distribute the file from the server to all peers if client-server mode is used? What is the
delay Dp2p if P2P mode is used? Draw a figure of Dcs and Dp2p under different N where N is from 1 to 50. Discuss Dcs and
Dp2p if N → ∞.
(2) Now we assume peers have different upload capacity.
bps for the ith peer. All other parameters are not changed.
Draw a figure of Dcs and Dp2p under different N where N is from 1 to 50. Discuss Dcs and Dp2p, if N → ∞.
Question 4 (P2P Tit-for-Tat, 18%). As shown in the figure below, A and B are communicating with their top-4 partners in a
BitTorrent system. A’s uploading and downloading data rates of the ith partner are ui and di respectively;They
are independent random variables, following uniform distribution in [0, 1] Mbps.
Now A optimistically unchoked B, with a sending data rate of rab. If A becomes a top-4 sender of B, B will start to serve A
with a sending data rate of rba. rab and rba are independent random variables, following uniform distribution in [0, 1] Mbps.
What is the probability that both A and B find each other a top-4 sender? Show your mathematical derivations.
Question 5 (Wireshark Experiment, 18%). In this task, you will run a Wireshark experiment. Please follow the following
procedure and answer questions.
Please note that you will need to connect to VPN if you are not on campus. Both FortiClient and Cisco AnyConnect are available.
You need to choose the correct interface in Wireshark indicating the VPN you are using. Otherwise, you cannot see the correct
packets captured.
1) Open a web browser. Clear the cache of the browser.
2) Start up the capture of Wireshark packet sniffer.
3) Enter the following URL into your browser.
http://wbserver.cs.usyd.edu.au/A1.html
4) Your browser should display text and an image.
5) When the image is completely loaded, enter the following URL into your browser
http://wbserver.cs.usyd.edu.au/A2.html
6) When the image is completely loaded, refresh your browser (e.g., press F5).
7) When the image is completely loaded, stop Wireshark packet capture.
Questions
(0) What is the time (date, hour, and minute) that you capture the packets? You will get 0 mark in Question 5 if you do not
provide the time.
(1) What is the IP address of the server that sends you the base web page?
(2) What is the IP address of the server that sends you the image?
(3) Is non-persistent HTTP or persistent HTTP employed? Why?
(4) What is the size of the image. How do you know that? You can only use the information provided by Wireshark capture.
(5) In step 3), your browser has downloaded the image for the first time. This image may or may not be re-downloaded again
in the following steps. In step 5), did you browser send the request for the image? If so, did the server send back the image to
your browser again? In step 6), did you browser send the request for the image? If so, did the server send back the image to
your browser again? (To answer these two questions, you should give screen-shots.)
(6) Now you need to have a close investigation of the image you have downloaded (when you download the image for the first
time). Locate the first four bytes of the image (.jpg file) in Wireshark. Screenshot the packet and location of the first four bytes
shown by Wireshark. Locate the last four bytes of the image (.jpg file) in Wireshark. Screenshot the packet and location of the
last four bytes shown in Wireshark.
To help you locate the bytes, you may consider to convert the original .jpg file into a byte-stream format. You may use the
following website https://www.onlinehexeditor.com/ to do so.
(7) Following (6), which one of the following statements is correct. Give your screenshots to justify your answer.
(a) The image is downloaded by a single packet.
(b) The image is downloaded by multiple packets and the last packet includes HTTP response (200 OK) and the last portion of
the image.
(c) The image is downloaded by multiple packets. The last packet includes the last portion of the image. Then, an HTTP response
(200 OK) is received in a separate packet.
6
Question 6 (Socket Programming, 10%). In this question, you are required to build a UDP client to the server using hostname
wbserver.cs.usyd.edu.au
and port number 12001. You client should be able to send a message to the server and receive a response message from the
server. The length of your message is limited to 100 characters. Your client must be in Python 3.
Still, please note that you will need to connect to VPN if you are not on campus. Both FortiClient and Cisco AnyConnect are
available. You need to choose the correct interface in Wireshark indicating the VPN you are using. Otherwise, you cannot see
the correct packets captured.
(0) What is the time (date, hour, and minute) that you complete this question? You will get 0 mark in Question 6 if you do not
provide the time.
(1) Send your student number (as a string encoded by utf-8) to the server and find the response message from the server.
(2) Use Wireshark to capture the response packet. Screenshot the packet.
(3) What is the IP address of the server? How does your computer know this IP address. Capture the packet that translates to
the IP address. Give your screenshot.