0% found this document useful (0 votes)
148 views13 pages

Ecs152b Final Exam Wq04

The document describes a final exam for a computer networks course consisting of 5 questions. The exam instructs students to write clearly and concisely, state any assumptions, and includes sample code and network diagrams related to questions about server/client implementations, TCP/IP concepts, and the Telnet application.

Uploaded by

Phuc Pham
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
148 views13 pages

Ecs152b Final Exam Wq04

The document describes a final exam for a computer networks course consisting of 5 questions. The exam instructs students to write clearly and concisely, state any assumptions, and includes sample code and network diagrams related to questions about server/client implementations, TCP/IP concepts, and the Telnet application.

Uploaded by

Phuc Pham
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

ECS152B - Computer Networks: Final Exam

March 16, 2004


There are 5 questions. Please write clearly and cleanly. Please be brief and to the point. If you make any assumptions, please state that clearly.

Question Question Question Question Question

1 2 3 4 5

Question 1 (25 points)


In order to be more ecient and provide better service to people, the local local soda delivery company has decided to connect all the soda machines to the Internet. For example, the soda machine in EUII that serves 10 types of sodas is connected to the Internet through a host named soda.cs.ucdavis.edu. This is shown in Figure ??. Write the code for an iterative server to be run

soda.cs.ucdavis.edu

Server

Soda Machine

Internet

Client

Figure 1: Virtual soda server. on soda.cs.ucdavis.edu and the code for client to be run on an arbitrary machine connected to the Internet that lets a user query the number of each type of soda left on the soda machine. Use the following pieces of information to write the programs: 1. The function int sodas-left (int soda-type) returns and integer corresponding to the number of sodas of type soda-type where soda-type is an integer from 1 to 10. 2. The soda server is bound to a well known port 42. 3. The client and the server use TCP socket. A transcript of a typical client session is as follows:

hostA> soda-client soda.cs.ucdavis.edu Please enter the type of soda you wish to query [1-10] (-1 to quit): > 3 2

There are 23 can left of soda type 3. Please enter the type of soda you wish to query [1-10] (-1 to quit): >10 There are 2 cans left of soda type 2. Please enter the type of soda you wish to query [1-10] (-1 to quit): > -1 hostA>

Question 2 (10 points)


For each of the statements listed below, please answer in true or false. If it is false, give a brief reason why. 1. With non-persistent connections between a browser and a server, it is possible for a single TCP segment to carry two distinct HTTP reuest messages. 2. The TCP sgment has a eld in its header for RcvWindow (Recieve Window). 3. Suppose the last RTT measurement in a TCP connection is equal to 1 second, then the timeut for the connection will be set to a value greaer than or equal to 1 second. 4. Suppose host A sends host B one segment with sequence number 38 and 4 bytes of data. Then in this segment the acknowledgement number is necessarily 42. 5. The backlog parameter in the listen system cal determines the maximum concurrency of a concurrent server. 6. Suppose we have a TCP client connected to an Ethernet network. If the client sends a stream of data to the loopback address an ARP request will be generated. 7. The concept of a maximum segment size at the TCP layer is unnecessary, since the path MTU will be the determining constraint on transfer sizes. 8. If the path MTU between two hosts is greater than the maximum segment size as specied at the TCP layer, data will be queued until the send size is at least as large as the path MTU. 9. The header checksum in an IP packet is unnecessary if the packet will be encapsulated in a TCP or UDP packet, since each of these higher level protocols has their own checksums that will cover the entire IP packet. 10. While in TCP/IP Illustrated, Stevens claims that four exchanges are necessary for the termination of a connection, it is possible to terminate a connection with only three exchanges.

Question 3 (20 points)


This question is about concurrent servers, port numbers, and socket descriptors. Let us consider a concurrent server. Clients connect to the server using the TCP protocol and exchange data. The server is connected to two dierent networks through two interfaces, IFA and IFB with IP addresses 128.120.56.35 and 128.120.55.1, respectively. We consider two dierent clients, referred as Host A and Host B with IP addresses 192.132.54.66 and 214.77.91.10, respectively. The server uses port number 80. The kernel in the server maintains a table for each socket descriptor and each table has the following entries: In this question you are asked to list all the tables and their contents as clients socket descriptor remote host remote port local host local port

connect to the server. Assume that socket descriptors are assigned from the sequence of integers starting from 1 and for simplicity we will assume that once a descriptor is assigned it is not used any more. Similarly, ephemeral port numbers in clients are chosen starting from 15000 and once a port number is assigned it is not used any more. 1. List the tables in the kernel and their contents, when the server is rst started and before any client request arrives. 2. List the tables and their contents when host A connects to the server through interface A (IFA) and is accepted by the server. 3. List the tables and their contents when host B connects to the server through interface B (IFB) and is accepted by the server. 4. List the tables and their contents after a second request is received from host B arrives through interface B (IFB) and is accepted by the server. 5. List the tables and their contents when the request from Host A is completely processed and the associated socket is closed.

Question 4 (20 points)

10

Question 5 (25 points)


The following questions are related to the Telnet application. Two machines nova.cs.ucdavis.edu and sgi1.cs.ucdavis.edu (referred to as nova and sgi1) are connected on an Ethernet segment as shown in Figure ??. Let Enova, Esgi1, IPnova, and IPsgi1 be the Ethernet abd IP addresses of nova and sgi1. The Ethernet segment also has a DNS server running on the machine dns.cs.ucdavis.edu (referred as dns) with IPdns and Edns as its IP and Ethernet addresses.
nova.cs.ucdavis.edu sgi1.cs.ucdavis.edu

IPnova Enova

IPsgi1 Esgi1

IPdns Edns dns1.cs.ucdavis.edu

Figure 2: The example network. A user on nova performs the folowing telnet session with the telnet server running on sgi1.

Line 1: nova>telnet sgi1.cs.ucdavis.edu ************************************************************************* This system is for the use of authorized users only. Individuals using this computer system without authority, or in excess of their authority, are subject to having all of their activities on this system monitored and recorded by system personnel. In the course of monitoring individuals improperly using this system, or in the course of system maintenance, the activities of authorized users may also be monitored. Anyone using this system expressly consents to such monitoring and is advised that if such monitoring reveals possible evidence of criminal activity, system personnel may provide the evidence of such monitoring to law enforcement officials. ************************************************************************* Line 2: login (sgi1.cs.ucdavis.edu:ghosal): ****** Line 3: Password:****** Line 4: Last login: Wed Mar 19 09:19:33 from nova Line 5: sgi1> Line 6: sgi1> cat Simulation.cpp Line 7: #include "Simulation.h" Line 8: 11

Line 9: Line 10:

} ^S {Flow control signal}

1. List the sequence of socket and socket related system calls that will be invoked in the client as a result of Lines 1, 2, and 3. 2. Assume that the ARP and DNS caches in nova are empty. List the Ethernet frames and their contents that will be generated as a result of Lines 1 and 2. You are required to ll in the elds of the Ethernet frames including the relevant data portion recursively upto the tranpsort layer as shown in Figure ??. Assume that the DNS queries and reply use UDP sockets. Also assume that ephemeral port numbers in clients are chosen starting from 15000 and once a port number is assigned it is not used any more.
Src Address Ethernet Frame Dest Address Type Data

ARP Message Type ARP Message

Source Addresses

Target Addresses

Source Address IP

Dest Address

Protocol

Data

Source Port TCP/UDP

Dest Port

Type/Contents of Message

Figure 3: Required elds of the frame. 3. When S, the ow control signal, is invoked in the client (Line 10), the server stops. Can you suggest how you can implement this telnet ow control by exploiting the TCP ow control algorithm?

12

13

You might also like