Homework Assignment 2

This assignment is to be done individually. Do not show your answers to others and do not look at other students' solutions. Prevent other students from accessing your solutions (do not put it in a public library). Provide short and concise answers to the questions below.

Question 1 (Sockets, 15%)

(a) When you call 'bind()' on a socket, what happens if you pass 'INADDR_ANY' as address?
(b) Describe the network traffic that results from a call to 'connect()' on a TCP socket. Assume that the destination address given to connect() is valid (there is a TCP server listening at the specified address).

Question 2 (Servers, 30%)

(a) Describe two potential deadlock situations for servers (i.e., how could a client cause a server to deadlock)?
(b) What is the purpose of the 'KeepAlive' directive in the Apache 2.0 configuration file?
(c) Obtain a freely available web server performance meter (e.g., httperf), install it, learn about its usage, and use it to measure the response times (reply times) of a web server of your choice. Set the performance meter to make requests once per second ten times and average the response times. Show the output of the performance meter for one request. Also, if you receive error messages, mention which errors and how many.

Question 3 (DNS, 10%)

(a) Show and describe the content of the /etc/resolv.conf file on your Linux computer.
(b) Use the 'host' command with the 'a' parameter (for the 'A' record of the DNS database) on any computer of your choice to retrieve the IP address. Show how you call the host command and the answer you received. Further, use the host command with the 'cname' parameter on 'www.cc.gatech.edu' and show the answer you received.

Question 4 (RPC, 15%)

(a) Why do you need a program number, a version number, and a procedure number for RPC servers?
(b) Why does the output parameter in the server procedure have to be declared 'static'?

Question 5 (Programming, 30%)

Imagine a simple TCP-based chat server allowing users to use any TCP client (telnet, for example) to communicate with each other. For this question, you can either implement (and test) the code or just provide the pseudo code (uncompiled code). The focus in this question is not on the correct use of all system call parameters, etc., but the correct sequence of system calls (or library calls) and the correct choice of calls. Also, error handling is not required. The server should be a single process, single thread server that can support exactly 2 clients at once. The server forwards whatever is sent from one client to the other (in both directions). Your server must not insist on any specific ordering of messages, as soon as something arrives on one socket, it will be forwarded to the other socket immediately. As soon as one client terminates the connection, the server can exit. Hints: open two passive sockets and then 'wait' for messages (do not use busy waiting, instead think of an efficient' way of waiting). When you read from a socket and 0 bytes of data are returned, the client has terminated the connection.

Submission

The due date for this homework is February 25th, 2005, 11.59pm EST. You will use the drop-off boxes, make a directory called "homework2" and place one single file (.ps, .pdf, .doc, or .txt) into this directory. Your file should clearly relate the answers to the questions (e.g., 'Answer 3a:', etc.). If you made any assumptions or encountered problems with the programming tasks, state these clearly in your document.
Late submissions: Unlike with the programming assignments, late homeworks will absolutely NOT be accepted!