Not for Summer 2003!
Current students should not do this part of the assignment.
Do only the Alternating Bit Protocol part.
You are to write the clientOutput()
,
clientInput()
, clientTimerInterrupt()
,
clientInit()
, serverInput()
,
serverInit()
, clientEnd()
, and
serverEnd()
functions which together will implement a
Go-Back-N unidirectional transfer of data from the
client-side (A) to the server-side (B) with a window size of eight.
Your protocol should use both ACK and NAK messages.
You must write your routines in the GBN/client.c and GBN/server.c files.
Kurose and Ross strongly recommend that you first implement the easier (Alternating Bit) protocol and then extending your code to implement this more difficult protocol. Believe them — it will not be time wasted! However, some new considerations for your Go-Back-N code (which do not apply to the Alternating Bit protocol) are:
Your clientOutput()
routine will now sometimes be
called when there are outstanding, unacknowledged messages in
the medium — implying that you will have to buffer multiple
messages in your sender. Also, you'll also need buffering in
your sender because of the nature of Go-Back-N:
sometimes your sender will be called but it won't be able to
send the new message because the new message falls outside of
the window.
Rather than have you worry about buffering an arbitrary number of messages, it will be okay for you to have some finite, maximum number of buffers available at your sender (50 messages for example) and have your sender simply abort (give up and exit) should all 50 buffers be in use at one point. (Note: if you use the values I've specified, this should never happen.) In the `real-world', of course, an implementor would have to come up with a more elegant solution to the finite buffer problem.
Your clientTimerInterrupt()
routine will be called
when the client's timer expires (thus generating a timer
interrupt). Remember that you've got only one timer, and may
have many outstanding, unacknowledged packets in the medium, so
you'll have to think a bit about how to use this single timer.
Write your functions so that they print out a message whenever an event occurs at your sender or receiver (a message/packet arrival, or a timer interrupt) as well as any action taken in response. Test your program to the point when 20 messages have been ACK'ed correctly at the receiver, with a loss probability of 0.2, and a corruption probability of 0.15, and a trace level of 2.