Please submit your coursework as a zip fifile via SurreyLearn. The zip fifile should contain a) a PDF with your written answers to the questions and b) your python code for which you should supply a short README.txt with instructions on how to run it.
Work you submit must be your own work.
By submitting your coursework through SurreyLearn you are declaring that this is your own work and it will be regarded as the equivalent of you having signed your declaration of originality. Late submissions will incur the standard 10% penalty per day. If the work is submitted later than TWO days after the deadline, it will be marked as 0 unless you have valid extenuating circumstances(ECs).
Deadline: 16:00, Monday, 24th May 2021
Returned by: Monday, 14th June 2021
1. This question is about the Internet, Delay and Packet/Circuit Switching. It is worth 25 marks.
(a) Suppose users share a 4 Mbps link. Also suppose each user transmits continuously at 0.5 Mbps when transmitting, but each user transmits only 30 percent of the time.
(i). When circuit switching is used, give a brief explanation of how many users can be supported? [2 marks]
(ii). For the remainder of this problem, suppose packet switching is used. Why will there be essentially no queuing delay before the link if 8 or fewer users transmit at the same time? Why will there be a queuing delay if 10 users transmit at the same time? [4 marks]
(iii). Find the probability that a given user is transmitting. [1 mark]
(iv). Suppose now there are 10 users. Find the probability that at any given time, any three users are transmitting simultaneously. [2 marks]
(b) Consider the circuit-switched network in the fifigure below.
There are 4 circuits on each link between the four switches A, B, C, and D.
(i). What is the maximum number of simultaneous connections that can be in progress at any one time in this network? [1 mark]
(ii). Suppose that all connections are between switches A and C. What is the maximum number of simultaneous connections that can be in progress? [1 mark]
(iii). Suppose we want to make four connections between switches A and C, and another four connections between switches B and D. Can we route these calls through the four links to accommodate all eight connections? If so how? If not, why not? [2 marks]
(c) Consider a packet of length L that begins at end system A and travels over three links to a destination end system (see Figure below):
(i). These three links are connected by two packet switches. Let di , si , and Ri denote the length, propagation speed, and the transmission rate of link i, for i = 1, 2, 3 . The packet switch delays each packet by dproc. Assuming no queuing delays, in terms of di , si , Ri , (i = 1, 2, 3) , and L, what is the total end-to-end delay for the packet? [2 marks]
(ii). Suppose now the packet is 1,500 bytes, the propagation speed on all three links is 2.5 ∗ 108m/s, the transmission rates of all three links are 2 Mbps, the packet switch processing delay is 3 msec, the length of the fifirst link is 5,000 km, the length of the second link is 4,000 km, and the length of the last link is 1,000 km.For these values, what is the end-to-end delay [2 marks]
(iii). Suppose R1 = R2 = R3 = R and dproc = 0 . Further suppose the packet switch does not store-and-forward packets but instead immediately transmits each bit it receives before waiting for the entire packet to arrive.
1. What is the end-to-end delay? [2 marks]
2. With R = 2Mbps and the lengths of the links are 5,000 km,4,000 km, and 1,000 km respectively, what is the end-to-end delay? [1 mark]
(d) In modern packet-switched networks, including the Internet, the source host segments long, application-layer messages (for example, an image or a music fifile) 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. The fifigure below illustrates the end-to-end transport of a message without (a) and with (b) message segmentation.
Consider a message that is 8 ∗ 106 bits long that is to be sent from source to destination in the above scenario. Suppose each link in the fifigure is 2 Mbps. Ignore propagation, queuing, and processing delays.
(i). Consider sending the message from source to destination without message segmentation. How long does it take to move the message from the source host to the fifirst packet switch? [1 mark]
(ii). Keeping in mind that each switch uses store-and-forward packet switching, what is the total time to move the message from source host to destination host? [1 mark]
(iii). Now suppose that the message is segmented into 800 packets, with each packet being 10, 000 bits long. How long does it take to move the fifirst packet from source host to the fifirst switch? [1 mark]
(iv). When the fifirst packet is being sent from the fifirst switch to the second switch, the second packet is being sent from the source host to the fifirst switch. At what time will the second packet be fully received at the fifirst switch? [1 mark]
(v). How long does it take to move the fifile from source host to destination host when message segmentation is used? [1 mark]
2. This is a coding exercise which will demonstrate your understanding of socket programming and simple protocols. It is worth 25 marks.
(a) Your task is to develop a simple mail client that sends email to any recipient. Your client will need to connect to a mail server, dialogue with the mail server using the SMTP protocol, and send an email message to the mail server. Python provides a module, called smtplib , which has built in methods to send mail using SMTP protocol. However, we will not be using this module in this lab, because it hides the details of SMTP and socket programming.
As most modern SMTP servers won’t let you interact easily, we have provided a fakeSMTP server as part of the code download. It’s a java application and you can start it by calling java -jar fakeSMTP.jar (see http://nilhcem.com/ FakeSMTP/ for more details)
Since port 25 for SMTP is a privileged port, you might not be able to run this application on that port in which case simply use port 2525.
Once you have started the server you should be able to connect to it using localhost and port 2525 (or 25 if you have rights to access to that port).
(i). Amend the provided smtp client.py code and fifill in the missing code segments indicated by ”#Fill in start” and ”#Fill in end” [7 marks]
(ii). Provide a screenshot of the fakeSMTP server showing that you indeed received the e-mail message. [2 marks]
(b) Your second task is to develop a basic web server that handles one HTTP request at a time. Your web server should accept and parse the HTTP request, get the requested fifile from the server’s fifile system, create an HTTP response message consisting of the requested fifile preceded by header lines, and then send the response directly to the client. If the requested fifile is not present in the server, the server should send an HTTP “404 Not Found” message back to the client.
Again since port 80 for HTTP is a privileged port, you might not be able to run this application on that port in which case simply use port 8080.
Put a HTML fifile (e.g., HelloWorld.html) in the same directory that the server is in. Run the server program.
“HelloWorld.html” is the name of the fifile you placed in the server directory. Note also the use of the port number after the colon. You need to replace this port number with whatever port you have used in the server code. The browser should then display the contents of HelloWorld.html. Then try to get a fifile that is not present at the server. You should get a “404 Not Found” message.
(i). Amend the provided webserver.py code and fifill in the missing code segments indicated by ”#Fill in start” and ”#Fill in end” [14 marks]
(ii). Provide a screenshot showing that you indeed retrieved the web page and that you can also receive a 404 error message. [2 marks]
3. This question is about the Application Layer. It is worth 25 marks.
(a) Obtain the HTTP/1.1 specifification (RFC 2616). Answer the following questions referencing the relevant sections where applicable:
(i). Explain the mechanism used for signaling between the client and server to indicate that a persistent connection is being closed. Can the client, the server, or both signal the close of a connection? [2 marks]
(ii). What encryption services are provided by HTTP? [1 mark]
(iii). Can a client open three or more simultaneous connections with a given server? [2 marks]
(iv). Either a server or a client may close a transport connection between them if either one detects the connection has been idle for some time. Is it possible that one side starts closing a connection while the other side is transmitting data via this connection? Explain. [2 marks]
(b) True or false? [5 marks]
(i). A user requests a Web page that consists of some text and three images. For this page, the client will send one request message and receive four response messages.
(ii). Two distinct Web pages (for example, www.mit.edu/research.html and www.mit.edu/students.html ) can be sent over the same persistent connection.
(iii). With nonpersistent connections between browser and origin server, it is possible for a single TCP segment to carry two distinct HTTP request messages.
(iv). The Date: header in the HTTP response message indicates when the object in the response was last modifified.
(v). HTTP response messages never have an empty message body.
(c) For a P2P fifile-sharing application, do you agree with the statement, “There is no notion of client and server sides of a communication session”? Why or why not? Support your argument using a P2P protocol of your choice [3 marks]
(d) This is a question about the P2P protocol BitTorrent.
(i). In BitTorrent, suppose Alice provides chunks to Bob throughout a 30-second interval. Will Bob necessarily return the favor and provide chunks to Alice in this same interval? Why or why not? [2 marks]
(ii). Consider a new peer Anna that joins BitTorrent without possessing any chunks. Without any chunks, she cannot become a top-four uploader for any of the other peers, since she has nothing to upload. How then will Anna get her fifirst chunk? [2 marks]
(e) For the client-server application over TCP why must the server program be executed before the client program? For the client-server application over UDP, why may the client program be executed before the server program? [4 marks]
(f) Is it possible for an organization’s Web server and mail server to have exactly the same alias for a hostname (for example, foo.com )? What would be the type for the RR that contains the hostname of the mail server? [2 marks]
4. This question is about the Transport Layer. It is worth 25 marks.
(a) True or false? [6 marks]
(i). Host A is sending Host B a large fifile over a TCP connection. Assume Host
B has no data to send Host A. Host B will not send acknowledgements to Host A because Host B cannot piggyback the acknowledgements on data.
(ii). The size of the TCP rwnd never changes throughout the duration of the connection.
(iii). Suppose Host A is sending Host B a large fifile over a TCP connection. The number of unacknowledged bytes that A sends cannot exceed the size of the receive buffffer.
(iv). Suppose Host A is sending a large fifile to Host B over a TCP connection. If the sequence number for a segment of this connection is m, then the sequence number for the subsequent segment will necessarily be m+1 .
(v). The TCP segment has a fifield in its header for rwnd.
(vi). Suppose Host A sends one segment with sequence number 38 and 4 bytes of data over a TCP connection to Host B. In this same segment the acknowledgement number is necessarily 42.
(b) Suppose Host A sends two TCP segments back to Host B over a TCP connection. The fifirst segment has sequence number 90; the second has sequence number 110.
(i). How much data is in the fifirst segment? [1 mark]
(ii). Suppose that the fifirst segment is lost but the second segment arrives at
In the acknowledgement that Host B sends to Host A, what will be the acknowledgement number? [1 mark]
(c) Suppose Client A initiates a Telnet session with Server S. At about the same time, Client B also initiates a Telnet session with Server S. Provide possible source and destination port numbers for [4 marks]
(i). The segments sent from A to S.
(ii). The segments sent from B to S.
(iii). The segments sent from S to A.
(iv). The segments sent from S to B.
(d) Is it possible for an application to enjoy reliable data transfer even when the application runs over UDP? If so, how? If not, why not? [2 marks]
(e) Suppose a process in Host C has a UDP socket with port number 6789. Suppose both Host A and Host B each send a UDP segment to Host C with destination port number 6789. Will both of these segments be directed to the same socket at Host C? If so, how will the process at Host C know that these two segments originated from two difffferent hosts? [2 marks]
(f) Consider transferring an enormous fifile of L bytes from Host A to Host B. Assume an Maximum Segment Size (MSS) of 536 bytes.
(i). What is the maximum value of L such that TCP sequence numbers are not exhausted? Recall that the TCP sequence number fifield has 4 bytes. Explain your answer. [2 marks]
(ii). For the L you obtained in the prev, fifind how long it takes to transmit the fifile. Assume that a total of 66 bytes of transport, network, and data link header are added to each segment before the resulting packet is sent out over a 155Mbps link. Ignore flflow control and congestion control so A can pump out the segments back to back and continuously. Show your working. [3 marks]
(g) In this question we investigate whether either UDP or TCP provides a degree of end-point authentication.
(i). Consider a server that receives a request within a UDP packet and responds to that request within a UDP packet (for example, as done by a DNS server). If a client with IP address X spoofs its address with address Y, where will the server send its response? [1 mark]
(ii). Suppose a server receives a SYN with IP source address Y, and after responding with a SYNACK, receives an ACK with IP source address Y with the correct acknowledgment number. Assuming the server chooses a random initial sequence number and there is no “man-in-the-middle,” can the server be certain that the client is indeed at Y (and not at some other address X that is spoofifing Y)? Explain your answer. [3 marks]