CS 640 Introduction
to Computer Networks
Programming
Assignment 1: Mock Name Server (MNS)
Please check
this page
for FAQs and frequent updates on
instructions.
Testing your program:
1. You use your client to test the basic lookup function of the server.
2. You use your client to test the server's redirect function.
3. You will test your client's ability to unpacke redirect information and
form a new query sent to the redirect server for new answer
Please
Note:
·
For testing purposes, we providing you a set of valid tables for mapping and
redirecting which should locate in the specific ports indicated by the
following table of the machine you work which is indicated by the following
table. Please replace X.X.X.X with the IP of the
machine you work on:
|
Server # |
Port # |
|
1 |
5200 |
|
2 |
5202 |
|
3 |
5204 |
Server 1:
Mapping File:
machine1.cs.wisc.edu 128.45.6.1
machine2.cs.wisc.edu 128.45.6.2
tom3.cs.wisc.edu
128.45.10.3
tomcat4.cs.wisc.edu 128.45.11.4
Redirect File:
tom4.cs.wisc.edu X.X.X.X 5202
128.45.6.3 X.X.X.X 5202
Server 2:
Mapping File:
tom4.cs.wisc.edu
128.45.10.4
tomcat5.cs.wisc.edu
128.45.10.5
Redirect File:
machine1.cs.wisc.edu X.X.X.X 5200
128.45.6.3 X.X.X.X 5204
machine5.cs.wisc.edu X.X.X.X 5200
Server 3:
Mapping File:
machine3.cs.wisc.edu 128.45.6.3
tomcat6.cs.wisc.edu
128.45.10.6
Redirect File:
tomcat4.cs.wisc.edu X.X.X.X 5200
machine1.cs.wisc.edu
X.X.X.X 5202
machine5.cs.wisc.edu
X.X.X.X 5202
Example Queries:
./client -s X.X.X.X -p 5200 -r 0 -d 128.45.6.3 -t 4 -n 4
machine3.cs.wisc.edu
./client -s X.X.X.X -p 5202 -r 1 -d tomcat5.cs.wisc.edu -t 4 -n 4
128.45.10.5
/client -s X.X.X.X -p 5202 -r 1 -d tomcat7.cs.wisc.edu -t 4 -n 4
unresolved
/client -s X.X.X.X -p 5206 -r 1 -d tomcat5.cs.wisc.edu -t 4 -n 4
timeout
·
What to submit:
You will need to submit the source
code along with the Makefiles in a
single tar.gz file (name it p1.tar.gz). The extracted directory p1 should in turn have two
sub-directories - client and server. The sub-directories should have
their respective codes and Makefiles. Do not submit object files, or
compiled executables. The Makefile should have two rules: clean and all.
clean will delete previous .o
files, executables, etc.
all should produce a single
executable called client/server.
The directory structure should look like this:
p1(dir)
|
---------------------------
| |
server(dir) client(dir)
|
|
|
|
server.c
Makefile client.c
Makefile
The TA will run the following sequence of operations to execute your
code:
tar xvfz p1.tar.gz
cd p1/
cd server/
make clean
make all
./server -p <port1> -f <mapping-file1> -r
<redirect-file1>
./server -p <port2>
-f <mapping-file2> -r <redirect-file2>
./server -p <port3>
-f <mapping-file3> -r <redirect-file3>
cd ../client
make clean
make all
./client -s
<server-name> -p <port> -r <req-type> -d <data>
-t
<timeout> -n <seq-no>
Please test to make
sure that these commands can execute in sequence without any
intervention.
·
How to submit:
First
add the following line to your .cshrc.local file (located in your home
directory):
set path =
($path /s/handin/bin)
Then
run the following command at the shell prompt:
source
~/.cshrc.local
Finally,
to handin your files, enter the following command:
handin -c
cs640-1 -a PA1 -d <directory>
where
<directory> is the path to the directory where p1.tar.gz is
located.
cp -r <directory>
~cs640-1/handin/<your_cs_login>/PA1
Make sure both the group members submit the same code.