0% found this document useful (0 votes)
97 views5 pages

Exam #1 For Computer Networks (CIS 6930) SOLUTIONS : Problem #1

This summarizes the solutions to an exam for a computer networks course. It includes solutions to 8 required problems and 1 extra credit problem. The problems cover topics like layered network models, sources of network delay, web server pseudocode, reliable data transfer protocols, TCP timeout calculations, bandwidth allocation, routing protocols, and the purpose of hierarchical addressing.

Uploaded by

87bb
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)
97 views5 pages

Exam #1 For Computer Networks (CIS 6930) SOLUTIONS : Problem #1

This summarizes the solutions to an exam for a computer networks course. It includes solutions to 8 required problems and 1 extra credit problem. The problems cover topics like layered network models, sources of network delay, web server pseudocode, reliable data transfer protocols, TCP timeout calculations, bandwidth allocation, routing protocols, and the purpose of hierarchical addressing.

Uploaded by

87bb
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/ 5

Exam #1 for Computer Networks (CIS 6930) >>> SOLUTIONS <<<

Fall 2003

Welcome to Exam #1 in Computer Networks (CIS 6930). You have 75 minutes. Read each problem carefully. There are eight required problems (each worth 12.5 points) and one extra credit problem worth 5 points. You may have with you a calculator, pencils, eraser, blank paper, and one 8.5 x 11 inch formula sheet. On this formula sheet you may have anything you want (definitions, formulas, etc.) handwritten by you. You may use both sides. Computer generated text, photocopies, and scans are not allowed on this sheet. Please submit your formula sheet with your exam. No sharing of calculators. Start each numbered problem on a new sheet of paper and do not write on the back of the sheets. Submit everything in problem order. Good luck and be sure to show your work. Problem #1 a) Central to the study of networks is the layered model. In this class we have at least two layered models that we work with. They are the OSI model and the Kurose/Ross model that structures our text book. Sketch these two models. For the OSI model, describe the function of the layers with one sentence for each layer.
OSI is Applications, Presentation, Session, Transport, Network, Data Link, and Phyiscal (top to bottom). Kurose/Ross is Application, Transport, Network, Data Link, and Physical (basically, the TCP/IP stack). For the OSI model: Application provides access to user applications Presentation provides data independence Session manages end-to-end connections Transport provides reliable end-to-end data transport Network maintains point-to-point connections Data Link provide reliable point-to-point data transport Physical transmission of bit stream

b) What are the four causes, or components, of delay in a packet switched network? What can be done to reduce each of these components?
The delay components are Processing, queueing, transmission, and propagation. Processing delay can be reduced by faster CPUs, queueing and transmission delay by faster links, and propagation delay only by moving content closer to its user.

Problem #2 a) Describe the operation of a Web server with high-level pseudocode. It is sufficient to show operation for only the case of HTTP GET.
Main process Listen for a connection on port 80 Accept a connection and spin-off a thread or process to handle the connection Handle GET process Parse the HTTP header for the GET object name Open the file for the object If file not found, send an HTTP 404 message If file found, send an HTTP 200 message followed by the file Close the connection Exit the thread or process

b) Attached is a sockets program. The program compiles successfully, but there are several errors in it. Identify these errors. Use the line numbers to help you describe where the errors are.
The program is missing hton*() conversions in lines 31 and 32. A bind() is missing following line 32. Also missing after line 32 is a listen(). In line 40 these should be a +1 to the string length (to include the end of string character needed in the receiver). Finally, at the end of the program a close of the connect_s socket is missing.

Problem #3 Consider a channel that connects a sender and a receiver. Assume that the channel never loses packets or gets them out of order, but it may corrupt them. Assume that the sender always sends unique packets and that the receiver does not care if it receives duplicate packets (e.g., it may have some way to determine if a packet is a duplicate). Design a reliable data transfer protocol for this system. You may use FSMs to describe your protocol. FSM for the sender
Wait for call from above Wait for ACK or NACK ------------------------------------------| | | (a) | |--------------------------------------------->|-------+ | (c) | | (b) |<---------------------------------------------|<------+ | |

For transition (a) the event is rdt_send(data). The action is sendpkt=make(data, checksum), udt_send(sendpkt). For transition (b) the event is rdt_rcv(recvpkt) && (iscorreupt(rcvpkt) || isNACK(rcvpkt)). udt_send(sendpkt). For transition (c) the event is rdt_rcv(recvpkt) && isACK(rcvpkt). The actionis nothing (null). FSM for the receiver
Wait for call from above -----------------------|------+ | | (a) |<-----+ | |------+ | | (b) |<-----+

The action is

For transition (a) the event is rdt_rcv(rcvpkt) && corrupt(rcvpkt). The action is udt_send(NACK). For transition (b) the event is rdt_rcv(rcvpkt) && notcorrupt(rcvpkt). The extract(rcvpkt, data), deliver_data(data), udt_send(ACK). For transition (b) the event is rdt_rcv(recvpkt) && (iscorreupt(rcvpkt) || isNACK(rcvpkt)). udt_send(sendpkt). The action is

Problem #4 Consider a link connecting a sender and receiver. The sender always has packets to send of length L bytes. GBN ARQ flow and error control is used. The link has a bit error rate of p. Write the expression for U in terms of tfr, tpr, N, and p for the case of window size is greater than pipe size (i.e., N multiplied by tfr is greater than two times tpr plus tfr).
U= t fr (1 p ) t fr + 2t pr p
for p = probability of packet error. If p = probability of bit error, we have U =

t fr + 2t pr 1 (1 p )

t fr 1 1 (1 p )

( (

(8L )

which simplifies to: U =

t fr (1 p )

(8L )

))

8 L

t fr + 2t pr 2t pr (1 p ) 8L

Problem #5 Carefully explain how TCP computes its retry time-out value.
TCP uses the following algorithm (with parameters g, h, and f) to estimate RTT and the possible deviation to RTT. The deviation is added to the estimated RTT. Exponential smoothing is used here. SRTT(k+1) = (1 g)*SRTT(k) + g * RTT(k+1) SERR(k+1) = RTT(k+1) SRTT(k) SDEV(k+1) = (1 h)*SDEV(k)+h*abs(SERR(k+1)) RTO(k+1) = SRTT(k+1) + f*SDEV(k+1) On a retransmit use exponential backoff of RTO (i.e., do not execute the above).

Problem #6 Consider five nodes (call them x1, x2, , x5) that request bandwidth on a common channel. The nodes request 2, 5, 5, 7, and 10 units of bandwidth, respectively. a) Give the max-min fair bandwidth allocation for a channel with 25 units of bandwidth.
All nodes can get what they request (i.e., the allocations are 2, 5, 7, and 10).

b) Repeat (a) for a channel with 15 units of bandwidth.


In the first round we allocate 15/5 = 3 units of bandwidth and get allocations 2, 3, 3, 3, and 3. There is 1 unit left to allocate to 4 nodes. In the second round we allocate 1/4 = 0.25 units of bandwidth and get allocations of 2, 2.25, 2.25, 2.25, and 2.25. There is nothing leftover, so this is the final allocation

c) Repeat (a) for a channel with 10 units of bandwidth.


In the first round we allocate 10/5 = 2 units of bandwidth and get allocations 2, 2, 2, 2, and 2. There is nothing leftover, so this is also the final allocation.

Problem #7 a) What is the key difference between distance-vector and link-state routing protocols in terms of how protocol messages are sent?
In distance-vector protocols message exchanges are between neighbors. In link-state protocols message exchanges are gobal (i.e., broadcast) to all nodes.

b) Give the names of a distance-vector algorithm and protocol. Give the names of a link-state algorithm and protocol.
RIP and BGP are distance-vector protocols. OSPF is a link-state protocol.

c) Give a simple example of the count-to-infinity problem.


Consider three nodes with A connected to B at cost 1 and B connected to C at cost 1. The route from A to C is through B at cost 2. If the link from B to C fails (now cost from B to C is infinity) the following will happen. At the next vector exchange A will learn that cost to B is infinity and enter this in its vector. However, B will learn that the cost to C is 2 via A and will enter 3 as its cost to C (going through A as the case may be). In the next exchange A will learn from B that the cost to C is 3 and now enter 4 as its cost to C. In this same exchange, B will learn from A that the cost to C is infinity, so it will enter infinity as its cost. And so on, until the cost to C is infinity for both A and B.

Problem #8 a) What is the purpose of hierarchical address in the Internet (i.e., why are IP addresses hierarchical)? Explain how the hierarchical address is used in IP routing.
By having an IP address hierarchical as network-host, we can reduce the size of routing tables by having routing tables only handle forwarding from network to network. Only at the destination network is the host address portion used for delivering the packet to the destination host.

b) Assume that hosts A and B have a TCP connection established. Assume that the two hosts are separate by one router (i.e., they are one hop apart). Why does host A not directly use the MAC (LAN) address of host B when constructing its packets to send to host B?
Host A has no way of knowing the MAC address of host B on the other side of a router. A router does not pass broadcasr ARP frames. In any case, the MAC address of the router port connecting host As LAN to host Bs LAN must be used to forward an A-to-B packet through the router. If some other MAC address (e.g., that of host B) were used, routing would not take place.

Extra Credit Give the names of up to five networking conferences. Each correct name will earn you one point of extra credit. Trade shows and local (e.g., from your university only) conferences do not count.
ICC, INFOCOM, GLOBECOM, SIGCOMM, and LCN are all networking conferences. Other possible answers include IPCCC, IC3N, Mobicom, and even VTC is acceptable. All have been discussed or mentioned in some context in the class. In any case, each of these conferences are likely to appear in the references in any paper you pick-up.

Program for problem #2


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 //============================================================ file = s.c ===== //= A message "server" program = //============================================================================= #include <stdio.h> // Needed for printf() #include <string.h> // Needed for memcpy() and strcpy() #include <windows.h> // Needed for all Winsock stuff #define PORT_NUM 1050 // Arbitrary port number for the server

void main(void) { WORD wVersionRequested = MAKEWORD(1,1); WSADATA wsaData; unsigned int server_s; struct sockaddr_in server_addr; unsigned int connect_s; struct sockaddr_in client_addr; struct in_addr client_ip_addr; int addr_len; char out_buf[100]; char in_buf[100]; // Initializes winsock WSAStartup(wVersionRequested, &wsaData);

// // // // // // // // // //

Stuff for WSA functions Stuff for WSA functions Server socket descriptor Server Internet address Connection socket descriptor Client Internet address Client IP address Internet address length 100-byte output buffer for data 100-byte input buffer for data

// Create a socket server_s = socket(AF_INET, SOCK_STREAM, 0); // Fill-in my socket's address information server_addr.sin_family = AF_INET; // Address family to use server_addr.sin_port = PORT_NUM; // Port number to use server_addr.sin_addr.s_addr = INADDR_ANY; // Listen on any IP address // Accept a connection. addr_len = sizeof(client_addr); connect_s = accept(server_s, (struct sockaddr *)&client_addr, &addr_len); // Send to the client strcpy(out_buf, "Test message from server to client"); send(connect_s, out_buf, strlen(out_buf), 0); // Receive from the client recv(connect_s, in_buf, sizeof(in_buf), 0); printf("Received from client... data = '%s' \n", in_buf); // Close and clean-up closesocket(server_s); WSACleanup(); }

You might also like