ecs152b final exam wq04

Upload: phuc-pham

Post on 05-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 Ecs152b Final Exam Wq04

    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 1

    Question 2

    Question 3Question 4

    Question 5

    1

  • 7/31/2019 Ecs152b Final Exam Wq04

    2/13

    Question 1 (25 points)

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

    Soda Machine

    soda.cs.ucdavis.edu

    Server

    Client

    Internet

    Figure 1: Virtual soda server.

    on soda.cs.ucdavis.edu and the code for client to be run on an arbitrary machine connected to theInternet that lets a user query the number of each type of soda left on the soda machine. Use thefollowing pieces of information to write the programs:

    1. The function int sodas-left (int soda-type) returns and integer corresponding to the numberof 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

  • 7/31/2019 Ecs152b Final Exam Wq04

    3/13

    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>

    3

  • 7/31/2019 Ecs152b Final Exam Wq04

    4/13

    4

  • 7/31/2019 Ecs152b Final Exam Wq04

    5/13

    Question 2 (10 points)

    For each of the statements listed below, please answer in true or false. If it is false, give a briefreason why.

    1. With non-persistent connections between a browser and a server, it is possible for a singleTCP segment to carry two distinct HTTP reuest messages.

    2. The TCP sgment has a field in its header for RcvWindow (Recieve Window).

    3. Suppose the last RTT measurement in a TCP connection is equal to 1 second, then the timeutfor 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 aconcurrent server.

    6. Suppose we have a TCP client connected to an Ethernet network. If the client sends a streamof 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 specified atthe 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 aTCP or UDP packet, since each of these higher level protocols has their own checksums thatwill cover the entire IP packet.

    10. While in TCP/IP Illustrated, Stevens claims that four exchanges are necessary for the termi-nation of a connection, it is possible to terminate a connection with only three exchanges.

    5

  • 7/31/2019 Ecs152b Final Exam Wq04

    6/13

    6

  • 7/31/2019 Ecs152b Final Exam Wq04

    7/13

    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 different networks through two interfaces,IFA and IFB with IP addresses 128.120.56.35 and 128.120.55.1, respectively. We consider twodifferent 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 thefollowing 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 integersstarting 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 aport number is assigned it is not used any more.

    1. List the tables in the kernel and their contents, when the server is first started and beforeany 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 andthe associated socket is closed.

    7

  • 7/31/2019 Ecs152b Final Exam Wq04

    8/13

    8

  • 7/31/2019 Ecs152b Final Exam Wq04

    9/13

    Question 4 (20 points)

    9

  • 7/31/2019 Ecs152b Final Exam Wq04

    10/13

    10

  • 7/31/2019 Ecs152b Final Exam Wq04

    11/13

    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 IPsgi1be the Ethernet abd IP addresses of nova and sgi1. The Ethernet segment also has a DNS serverrunning on the machine dns.cs.ucdavis.edu (referred as dns) with IPdns and Edns as its IP andEthernet addresses.

    nova.cs.ucdavis.edu sgi1.cs.ucdavis.edu

    IPnova IPsgi1

    Esgi1

    IPdns

    Edns

    dns1.cs.ucdavis.edu

    Enova

    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

  • 7/31/2019 Ecs152b Final Exam Wq04

    12/13

    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 clientas a result of Lines 1, 2, and 3.

    2. Assume that the ARP and DNS caches in nova are empty. List the Ethernet frames andtheir contents that will be generated as a result of Lines 1 and 2. You are required to fillin the fields of the Ethernet frames including the relevant data portion recursively upto thetranpsort 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 15000and once a port number is assigned it is not used any more.

    Src

    AddressType Data

    Address

    Dest

    Source Port Dest Port Type/Contents of Message

    Source Dest Protocol

    Ethernet Frame

    ARP Message

    IP

    TCP/UDP

    ARP Message

    TypeSource Addresses Target Addresses

    Address Address Data

    Figure 3: Required fields of the frame.

    3. WhenS, the flow control signal, is invoked in the client (Line 10), the server stops. Can yousuggest how you can implement this telnet flow control by exploiting the TCP flow control

    algorithm?

    12

  • 7/31/2019 Ecs152b Final Exam Wq04

    13/13

    13