Corporate and Professional Publishing Group

An Engineering Approach to Computer Networking

by S. Keshav

ISBN 0-201-63442-2 * Hardcover * 688 pages * 1997

Book Description Preface Glossary Bibliography Solutions Slides Simulator Exercises Errata Cover (73K) Ordering Information C&P Welcome Page.

Simple Node Function


Your assignment is to build a node function that implements both a simple sender and a simple receiver. You will do so by modifying a template file called ecn_simple.c that can also be found in the sim/sources directory.


The sender sends a DATA packet once every second to the receiver. Every time the sender sends data, it should print out:

where TIME is the current time and SEQ NO is the current sequence number (incremented by sender each time a packet is sent).

The receiver should reply to each DATA packet with an ACK packet, which the sender drops. Every time the receiver receives data, it should print out:

On receiving an ACK, the sender should print out:

The sender should stop after sending 25 packets (this should be read from the num_packets global variable set from the ecn/simple.l file).

The sender and receiver should be linked with a transmission link that has a bandwidth of 1000 bits/sec and 0 s delay (this is described in the input file called simple.l, which can be found in the sim directory). The packet size should be10 bytes (to be written into the pkt->size field).

Sample output can be found here.

How to do the assignment

1) Locate the sim directory that was created as a result of installing REAL.

2) To build the simulator, type make in the sim/sim directory. This will create the `simulate' binary.

3) To test whether your built the simulator correctly, type simulate example.l in sim/sim directory to run the simulator on a simple example file. You should see a trace of a simulation where packets generated from two Poisson sources share a single router. A summary of the simulation will be written into the file example/dump.

4) Read documentation in sim/docs/ and sim/docs/ to understand how to modify the simulator.

5)  Locate the file ecn_simple.c in the directory sim/sim/sources. Modify it as described in the file. (Note that in the current distribution of REAL, there is a bug in line 109. The line should read 'set_timer (1.0, tick_pkt)'. This is fixed in the link above.)

6) Rebuild the simulator using make.

7) Test whether your modifications were correct by running the simulator (type simulate ecn/simple.l) and comparing with the correct output.


Grading will be based as follows: Send your copy of tsource.c to the TA, who will compile the simulator with your submission, and compare the output with the standard one. If they match, you will get full credit, otherwise, you will get none. We will check your code so that you do not just put in a whole bunch of printfs!

Hints on using the simulator

Please read the users manual and programmers manual (in sim/docs).

It is easiest to write the code incrementally - first outline the state diagram, then try to just send packets, then write the send and receive sides

Note that the parameters.h file in sim/kernel contains global values read in from the input file - you may add some things here if you want.