Computer Networks Exam, 1st term – June, 1st 2009 Name: Rules: Short answers are appreciated. Each question scores 2%. Duration 2 hours. 1. Who can write a Request For Comments document? What for? Anyone. RFCs detail protocols to be used over the Internet. 2. Why some networks require data to be split into packets? Because then packet switching can be used. Packet switching has a delay close to circuit switching delay (which is good). 3. What type of resource allocation is used in circuit switching networks? Static allocation. 4. List three possible sources of delay on a packet switching network. Propagation delay, transmission delay, queuing delay. 5. List the names of the layers of TCP/IP architecture. Application, Transport, Network, Link and Physical layers. 6. In the client-server model, can a server serve more than one client at a time? Yes, they are called concurrent servers. 7. Are peer-to-peer programs illegal? Why? Not in here. Software is a tool, and tools are hardly considered illegal. 8. What is the electrical cable that provides the most bandwidth? What is it used for? Coaxial cable. Among other uses you can find it on your TV set antenna. 9. What is smbmount command for? It allows you to mount a network shared folder on your filesystem. 10.What those connecting to port 1050 will obtain after we run the following command: sock l :1050 d cat It is a line-oriented echo server. Each typed line will be echoed back to you. 11.Explain how user authentication is done in FTP protocol. "USER name" and "PASS password" commands are sent from the client. Server will accept the user if name/password are valid credentials. 12.Write the Java code for creating a UDP datagram variable (dp) that contains the string "I'm UDP".
int[] buffer = new buffer[1024]; String msg = "I'm UDP"; buffer = msg.getBytes(); Datagram Packet dp = DatagramPacket(buffer,buffer.count); 13.What is wrong with the following code: Socket s = Socket("www.upv.es","80"); The second parameter "80" should be an int (quotes are wrong!) 14.Can you stop a running thread from running during 1 second? How? Yes, it is Thread.sleep(1000); 15.What is a concurrent server? It's a server that can handle several clients at the same time. 16.What is the HTTP/1.1 request "Host:" header-line for? Is it mandatory? It's a header line for the client to specify the name of the server. It is used to enable virtual servers capability. It is mandatory in HTTP/1.1 17.What is pipeline operation in an HTTP/1.1 web server? It allows the client to send several requests at once. It might speed up the response time. 18.Which HTTP method is mostly used for uploading contents to the web server? POST method 19.What is the purpose of a PTR (DNS) query? It is a pointer query: Client provides an IP address and waits for the associated name (if any). 20.A web browser downloads a web page that contains four images. How many round-trip times are needed if pipelining is used? (Let's assume transmission time is negligible). 3 RTTs 21.What is PORT command used for (in FTP protocol)? To inform the server what IP and port to connect to for the next data transfer. 22. LIST command responses (in POP3 protocol) are several lines long. How does the client know an answer from the server is over? Last line of the response consists of a single dot "." 23.How can we store the contents of the string s in the byte array dat? (Let's assume dat is large enough). dat = s.getBytes(); 24.What is the optimal window size (sliding window protocol) if transmission time is 10 msec and propagation delay is 100 msec? (Assume ACK time is negligible).
N=(100*2+10)/10=21, this way continuous transmission can be achieved. 25.What happens after a timeout event on a Selective Repeat sliding window protocol? Only the oldest segment is retransmitted. 26.What fields can we find on UDP header? Source port, destination port, datagram length and datagram checksum. 27.What is the maximum size of a UDP datagram? 65535 bytes is the maximum IP datagram, 65535-20-8=65507 bytes (minus IP header, minus UDP header). Such a result is only theoretical as no real implementations will allow that. 28.What type of service does TCP protocol provide? List three of its features. TCP service is connection-oriented. In-order delivery, flow control, congestion control. 29.What is "Receive Window" TCP header field for? It reports the receiver buffer free space for flow control purposes. 30.What does happen to a TCP connection if a segment with the flag RST set is received? The connection is aborted. Data might be lost. 31.Is it possible for three consecutive TCP segments to be transmitted with the same sequence number? Why? Yes, it happens every time no new data is transmitted. These segments might be sent for acknowledgment purposes only. 32.What is the MSS value? (MSS = Maximum Segment Size). When is it determined? It is maximum data size of a TCP segment, determined when the connection is opened. 33.Does TCP use the same timeout value for each connection? Why? No, each connection uses a varying timeout period. It is different even for different moments of the same connection to adapt to network conditions. 34.What is TCP's "delayed acknowledgment"? ACKs are delayed 500ms (only one segment ACK is pending). 35.What is TCP's "Slow Start"? How does it work? It's part of TCP's congestion control. It increases the congestion window size 1 MSS each time an ACK is received. 36.What does a TCP-receiver end do when an out-of-sequence segment is received? An ACK is sent immediately (ack number will match the first missing byte).
37.How does a TCP connection is established? By the three way handshake (SYN; SYN+ACK; ACK). 38.How does a TCP connection is closed? By a four way handshake that might use three segments (FIN; ACK[+FIN]; ACK;) or not ([+FIN] might appear as a fourth segment). 39.Write Java code to extract the URL and print it to the screen, continue code below: ServerSocket ss = ServerSocket(80); // it's a web server, so it's http protocol ... Socket s = ss.accept(); // wait for client ... Scanner sc = new Scanner(s.getInputStream()); sc.next(); System.out.println(sc.next()); 40.What will happen when you print text using pw, ( PrintWriter pw = new PrintWriter(s.getOutputStream());)? When lines will actually be transmitted? Data might be stored in the send buffer. Lines will be transmitted when flush() or close() methods are called. 41.What is an iterative server? A server than only handles one client at a time. 42.How can you know (in Java) the size of the file Mystery.txt ? File f = new File("Mystery.txt"); System.out.println(f.length()); 43.When reading from an InputStream, how do you know the end of the stream has been reached? When read call returns -1 44.Match the terms "linear increase" and "multiplicative decrease" with events on TCP congestion control. linear increase occurs while congestion avoidance while multiplicative decrease happens after receiving three duplicated ACKs. 45.What is the value of the congestion window after a timeout event? CongWin=1 46.What happens to the congestion window during the congestion avoidance phase? It is incremented by 1 MSS each RTT if all the ACKs have been received. 47.When is Threshold value updated during congestion control? What is the new value? Threshold=CongWin/2 48.Do you remember the expression of the estimated RTT used by TCP?
EstimatedRTT = (1-α)*EstimatedRTT + α*SampleRTT /* α = 0.125 */ 49.How is it marked the end-of-line in HTTP protocol? And in FTP? CR+LF ("\r\n"). Same for FTP. 50.Write Java code to receive one datagram over port 1050. byte[] buffer = new byte[1000]; DatagramPacket dp = new DatagramPacket(buffer, buffer.length); DatagramSocket ds = new DatagramSocket(1050); ds.receive(dp);