CS 640 Introduction
to Computer Networks
Programming
Assignment 2: Routing Protocol
Please check this page for FAQs and frequent updates on instructions.
Note: we will also have demo.
Two groups will work together to demostrate that their server can work with
each other. You also need to tell TA about what tests you have done on your
server to ensure the robustness.
Frequently Asked Questions:
(1) You should be able to run the commands (update, step,
packets, display, disable, crash) while the servers are
running.
Use the select( ) call and add the fd of
the standard input/output as show below:
FD_ZERO(&socket_set);//clears
it out
FD_SET(sockfd,&socket_set);//places our socket into the set
FD_SET(0,&socket_set);//add fd of standard input/output
results = select(FD_SETSIZE, &socket_set, (fd_set *) 0, (fd_set *)
0,NULL);
(2) For sending periodic updates you will have to use
setitimer( ) and
sigaction( ). Look at the man pages
for usage.
- When using signact(), it may cause some problem in using select() function.
If you use printf("%m\n", errno); to print out the
error message, it will show "Interrupted system call".
Please use the following code to check whether the error is caused by
system interruption. If so, please just neglect it.
result = select(...);
if(result < 0){
if(errno != EINTR){
printf("Erros is not caused by system interrupt\n");
}
}
(3) Here are the topology files for the example topology. You can use
them to test your code. Right click and save the files. top1.txt is for
server 1, top2.txt for server 2 and so
on. You will have to modify the IP addresses and the port numbers in
the files.
top1.txt
top2.txt
top3.txt
top4.txt
top5.txt
- The topology file is complete and thus it contain the IP address and port
of the server which read this topology file. You may get your IP address
and port by using server ID and the server list in the toopoly file
(4) Do
appropriate error
checks.
Submission
Instructions:
What to submit:
You will need to submit the
source
code along with the Makefile in a
single tar.gz file (name it p2.tar.gz). The extracted directory p2 should contain the server code
and the Makefile.
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 server.
How to submit:
First
add the following line to your .cshrc.local file if you have not done
that before(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 PA2 -d <directory>
where
<directory> is the path to the directory where p2.tar.gz is
located
handin
will go through the specified directory and hand in the tar ball.
Make sure both the group members
submit the same code.
The example topology files described
in FAQ4 will be used for testing your code.