Virginia Tech
Department of Computer
Science
CS4254 Computer
Network Architecture and Programming
Spring 2006
This homework will be submitted online using the Curator system at http://courses.cs.vt.edu/curator/CourseLinks.html. Follow the link that has our course name and number. Please do not submit binaries or object files. Your source code should be accompanied by a make file and a README file explaining how to generate relevant binaries, and any other necessary information to run your programs. Every student gets a maximum of 3 submissions. Your last submission will be the one graded. No late submissions will be accepted.
Q1. (10 pts) Write C source code to conclude what is the potential problem with binding a UDP socket to INADDR_ANY, when that UDP socket will be used to receive multicast messages from a multicast group. Describe how your source code can be used to demonstrate such potential problem. Describe a remedy for such problem and implement it.
Q2. (30 pts) Write C source code for a multicast client/server to test multicast connectivity between machines on the Internet, using the following specifications.
Server
- The server accepts as an argument a port number
Ø
Usage:
mserver <
-
The server creates a
-
Clients will connect to the
- Upon connection, the server forks a child to handle that client.
- The child sends back to the client the following information
Ø multicast group address: created by obtaining the client’s IP address and substituting the first byte by 226, e.g., if the client’s IP is 128.82.70.30, the group address is 226.82.70.30.
Ø
multicast
port number: created by obtaining the client’s
- The child will create a UDP socket in order to send multicast datagrams to the formed multicast group with a suitable TTL value (initial TTL value is 2).
- the child sends 5 messages to the multicast group
Ø
A message consists of the current time of day +
the current TTL value appended to it, e.g., “Wed
- After sending the 5 messages, the child terminates
Client
-
The client accepts as arguments a
Ø
Usage:
mclient <
-
The
client connects to the
- Upon successful connection, the client gets back from the server the following information
Ø Multicast group IP address
Ø Multicast group port
- The client will create a UDP socket to receive multicast datagrams from the multicast group
- If multicast connectivity is available between the server machine and the client machine, the client should receive some messages (maximum of 5) from the server (Assuming multicast connectivity is available, and a suitable TTL value was used such as the server’s transmissions could reach the client)
-
The client displays the received message, e.g.,
“received from <server IP: server port> message “Wed
- The client can tell if the last message was received by inspecting the TTL value embedded in the message. Note that some messages could be lost or maybe will not be delivered to the client because of the current setting for the TTL value. Hint. If no messages were received, the client should not wait forever.
- The client displays the results of the multicast test as follows
Ø Apparently, if no messages could be received from the server, no multicast connectivity is available between the client and server (Assuming no lost messages).
Ø Some messages could be received, which implies multicast connectivity is available using a minimum value for the TTL. The client identifies the proper TTL value (Assuming no lost messages).
- The client terminates after displaying the multicast test result.
For the client and server, your code should provide suitable error checking and diagnostic messages. For example, the server and client should display the multicast group information used for conducting the multicast upon sending it or upon receiving it.
Provide test cases that would produce different test results. Provide actual output for such test cases using your source code.