




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Fall 2006 Midterm Material Type: Exam; Class: Network Application Design; Subject: Electrical & Computer Engineer; University: Virginia Polytechnic Institute And State University; Term: Fall 2006;
Typology: Exams
1 / 8
This page cannot be seen from the preview
Don't miss anything!





Part A: Multiple Choice: Choose the best answer for each question. If unclear, state any assumptions that you make in answering the question. (3 points each).
(a) TCP provides a reliable datagram service, while UDP provides a best-effort datagram service. (b) TCP provides a reliable stream service, while UDP provides a best-effort datagram service. (c) TCP uses a header, so it is less efficient than UDP which is a âheader-lessâ protocol. (d) TCP uses port numbers to identify process- or application-level end-points, while UDP does not use port numbers. Answer: (b). Only answer (b) is true.
(a) A socket created by a client and that is connected to the server. (b) A socket created by a server and that is connected to the client. (c) A socket created by a server and that is used to accept connections from a client. (d) A socket temporarily created by a server to receive UDP datagrams.
Answer: (b). An ephemeral socket is created when the accept call returns and is connected to the client whose connection was accepted.
(c) TCP provides the server with the IP address and port number of the client when there is a connection request. UDP does not provide this information when it establishes a connection. (d) The server needs to know the IP address and port number of the client. With UDP, this is provided by the client sending a message to the server. With TCP, this is provided by the client connecting to the server. Answer: (d). Only answer (d) is correct. Note that UDP does not establish a connection, as specified in answer (c).
(a) Socket.Socket() (b) Socket.Connect() (c) Socket.Synchronize() (d) Socket.Accept()
Answer: (b). Calling the Socket.Connect method at the client causes TCP at the client to generate a SYN request to the server. TCP at the server will also generate a SYN request to the client, but this might be done by TCP at the server before Socket.Accept is called, as is the case with pending connections. So, answer (a) is better than answer (b). There is no such method as Socket.Synchronize.
(a) No. It supports âcookiesâ that provide state information. (b) No. It uses TCP which is a stateful protocol. (c) Yes. No state is maintained by HTTP between different HTTP requests. (d) Yes. It uses UDP which is a stateless protocol.
Answer: (c). HTTP is stateless, although other schemes may be used with HTTP to maintain state. For example, using cookies is a way to maintain state, but state is maintained outside of TCP. HTTP uses TCP, not UDP.
(a) When both the client and server use only HTTP/1.1. (b) When the client-server round-trip time is low. (c) When objects are being transferred from client to server using PUT or POST. (d) When small objects are being transferred.
Answer: (d). With non-persistent connections, a TCP connection has to be established for each object retrieved. This adds a round-trip time (RTT) to the access for every object. This is the most significant if the object is small so that the RTT dominates the transfer time or if the RTT is high. So, persistent connections offer the greatest advantage if the RTT is high or the object size is small. Note that persistent connections can be used with either HTTP/1.1 or HTTP/1.0, but is the default in HTTP/1.1.
(c) TCP at the client waits to receive a âFINâ from the server and then sends a âFINâ and an âACKâ to TCP at the server. (d) TCP does not send any segment initiated by this Shutdown call.
Answer: (b). TCP at the client will send a âFINâ to TCP at the server. This does not free resources as in answer (a). TCP at the client can still receive data from the server and, when it receives a FIN from the server, it will send only an âACKâ back to the server. This is contradictory to answer (c). Answer (d) is also false.
(a) To detect a client that is âhungâ or otherwise unresponsive. (b) To help avoid deadlock due to an unresponsive client. (c) To wait for TCP to complete sending a stream of data from the client. (d) To reduce resources expended due to a denial-of-service attack. Answer: (c). Time-outs are not a way to deal with TCPâs Nagle algorithm, as suggested by answer (c). The other answers are all appropriate uses for time-outs at the server.
Answer: (d) TCP maintains reliable communication so Socket.Receive receives the string in the correct order and no packet loss should happen. TCP does not maintain the boundary of application layer packets. Hence, Socket.Receive may only return part of the string. Calling Socket.Receive multiple times will ensure that the remainder of the string gets received.
(a) Physical layer, data link layer, network layer, transport layer, session layer, presentation layer, application layer (b) Nework access layer, Internet layer, Host-to-Host layer, Process layer (c) ARP layer, IP layer, TCP layer, Application layer (d) Hardware interface layer, Application pogram interface layer, User interface layer Answer: (a)
(a) To maintain strong consistency, a client should not cache any objects.
(b) To maintain weak consistency, a client should check an object by sending a conditional get with if-modified-since header line every time the object is referenced. (c) Consistency is not an issue for HTTP since HTTP server is stateless. (d) HTTP reverse proxy cache is usually located close to HTTP servers while HTTP forward proxy cache is usually located close to HTTP clients. Answer: (d). A client can maintain strong consistency while still cache an object. To ensure strong consistency, a client just check the object by sending a conditional get with if-modified-since header line every time the object is referenced. For week consistency, a client only checks the object after a certain expiration date. Hence, (a) and (b) are incorrect.
(a) The TTL (Time To Live) field in the IP header of a packet specifies the maximum number of seconds that this packet can exist in a network (b) The TTL (Time To Live) field in the IP header of a packet specifies the maximum number of routers that this packet can pass (c) An IP address uniquely identifies a network protocol (d) IP provides reliable services by using IP level acknowledgement packets
Answer: (b). IP address identifies a network interface. IP is unreliable
(a) Receive() (b) Bind() (c) Accept() (d) SendTo() Answer: (b).
(a) Iterative connectionless (b) Iternative connection-oriented (c) Concurrent connectionless (d) Concurrent connection-oriented
Answer: (d).
(a) They require the use of the UDP protocol (b) They send out-of-band data (c) They have low latency (d) They require less data to be transferred between the client and server
Correct answers need to provide at least three distinct ways for determining end of application layer message. The socket.Receive() function returns with 0 bytes received, indicating the client side close its connection and is not going to send any additional data. The message has a special byte sequence that marks the end of the message. When the server sees this special byte sequence, the server knows that it reaches the boundary of the application layer message. The message has a length field that indicates the length of the message. When the length of the message equals the length fieldâs value, the server knows that it reaches the boundary of the application layer message.
Answers that are also correct though are not taught in class: There is a default size for the message defined by the application layer protocol
http://: the protocol is http mytest.org: host name 5676: port number /cgi-bin/customer.pl: cgi script name and its location id=SFTW: data passed to cgi script
Figure 1: TCP client and server
Figure 2: UDP client and server