ECE 544 Project 2: ARQ Scheme Design
to Software Project Homepage ]
As part of project 2 you are required to design a protocol to transport a file from
one end of a communication link to the other end over an unreliable
link. The host which has the file is the "sender". The other host
is the "receiver". Both directions of the link are lossy.
As the link is not perfect, you have to design an ARQ scheme to
overcome possible packet loss. Stop-and-Wait, Go-back N, selective ACK,
Sliding window..., using ACK or NACK?. It's all up to you. Any working
link control scheme is acceptable.
However, to encourage you to design scheme with better performance, the
designer of the program which spends least time to transport the given
file (a 100KB-size file ) through the link will get extra credits.
- The file must be transferred from sender to receiver without any
distortion/damage. In a word, the content of the file in receiver side
must be exactly as same as the original file. The file shall not be
compressed before transmission.
- Before the transfer of the file, the name of the file has to
be sent to the receiver in a packet ahead.
- You must design a packet header to carry some signaling
information. It should at least includes
- the sender's own identification/name (you could use characters or
- message type (DATA, ACK, NACK....)
- sequence number.
- The packet header cannot exceed 256 bytes
- Each packet's size (including header) cannot exceed 1,466 bytes. (Can you guess why? Include your answer in your project report.)
- The filename of the transferred file cannot be hard-coded in your program. You must put the
filename as a command-line argument of the sender program. Also, the
receiver need to store the file in a name. This name shall be a command
line argument of the receiver program, too.
- When the transfer finishes, at least one of the two programs
shall exit gracefully (not hanging).
Where to start
In the package you downloaded, you will find text2.dat. This is the
file you need to transfer.
In src/ directory, there are two files: common.h and common.cpp, which
provide some basic classes and functions. The documentation of
them could be found in doc/ directory.
Please refer to the examples to learn how to use it.
Then, check newport.h to see how a child class is derived from the
How to Test
If running the program only using the two application clients, setup the the used ports with the following characteristics:
I suggest you test your own program and fix any errors before
- The packet over the link is either lost or received completely.
- Loss probability is 0.2.
- No partial information is heard and no needs for a CRC check.
You can use the provided virtual machine to test your program.
Run each program in a separate console. The sender need send to
"localhost" (the destination address of the sending port). The receiver
also needs to send to "localhost" if it sends back some feedback
Use "diff" command to see if the received file is as same as the
- There is one timer associated with each sending port. If you
think your protocol programming need more timers, you can design a new
class like SendingPort class, with more timers. Please place your
design in a separate file. Then derive your working class from that
- If you want to combine the functions of a sending port and a
receiving port in a new class, e.g. "new_port", and use it in both
sender and receiver side, go ahead to design it in a separate file.
- You may wonder why the sender and receiver have different protocols(programs). They need not to be different and shall be same.
But as we mixed application (a uni-directional file transfer) with a
link layer protocol in a same C++ program, it turns out to be two
- Use gdb for debugging purpose. If you use the "Makefile" I give,
the compilation use -g option to enable gdb debugging by default.
- Do not remove "-lpthread" part of the Makefile, it is mandatory
when Linux threads are used.
- The 256 byte for packet header size is only an upper bound. You
can choose what any small number you want for header size. The
PacketHdr class does not hard code any format. You can use its API to
design your format.
- To tar files under a specific directory into a file, use " tar
-cvf project1.tar project1/"