EEC484/584 Project#2 Go-back-n Protocol …



Cleveland State University

Department of Electrical and Computer Engineering

EEC 484/584 Computer Networks

EEC584 Project#2

Implementing a Go-Back-N Reliable Data Transfer Protocol

Due date: April 25 Midnight

(15% per day late penalty)

In this project, you will be implementing a go-back-n based reliable duplex data transfer protocol. The protocol uses a 3-bit go-back-n sliding window protocol. The sequence number is 3-bit wide, i.e., it varies from 0 to 7. The sliding window size is 7 (not 8, as explained in the textbook, with similar reason as that for selective repeat protocol).

Even though the protocol pseudo code is introduced in the context of data link layer in the textbook, the protocol is applicable in the transport layer as well. We assume that our protocol runs in the transport layer and on top of a best effort network layer protocol, i.e., the transport protocol runs on top of a lossy channel. Since it is not convenient to program against the real APIs in this level (you need to write kernel code and access raw IP APIs), a simulated environment is provided. The simulated environment consists of three layers:

o The network layer. It is simulated using UDP. It is fully implemented. You need to modify the loss rate control only.

o The transport layer. A reference implementation of the go-back-n protocol is provided in binary form. The source code of the reference implementation is made available with certain parts omitted (to be completed by you). The go-back-n protocol provides APIs for application layer programs to send and receive messages, just like TCP does in practice.

o Application layer. A pair of test applications for the go-back-n protocol are provided to you. Since the protocol supports duplex communication, the two applications are called Alice and Bob, respectively, rather than sender and receiver. Alice sends two messages to Bob, and waits a message coming from Bob (the message might not be a reply to the previous two messages). Similarly, Bob sends one message and waits for two incoming messages from Alice.

The APIs provided by the go-back-n protocol are defined in the TransportLayer class. They have the following signatures:

public synchronized int send(String msg);

public synchronized int recv(byte[] buffer);

The skeleton code provided to you contains technical details on the requirements of the input/output parameters and their behaviors. In particular, send() might return an error code (i.e., -1) when the message is too big, or when the send buffer is full (the send() method is essentially a non-blocking call), and the application must check the return status to know if the message has been sent out successfully. On the other hand, the recv() method is blocking, i.e., it returns only if a message is received.

In the go-back-n protocol implementation, there are three different events to be handled, they are:

o EVENT_PACKET_ARRIVAL: this event signify the arrival of a packet from the network

o EVENT_TIMEOUT: this event indicates that the retransmission timer for a packet has expired and all the outstanding packets need to be retransmitted

o EVENT_MSG_READY: this event indicates that the application has a message to send.

The three types of events are set through the following three public methods defined in TransportLayer class:

public synchronized void onPacketArrival();

public synchronized void onTimeout();

public synchronized int send(String msg);

The onPacketArrival() method is invoked by the NetworkLayer object when a packet arrives. The onTimeout() method is called by the packet object whose retransmission timer has expired. The send() method is called by the application program when it has a message to send.

The diagram below provide additional implementation details of the reference implementation of the protocol and its environment:

[pic]

The reference implementation consists of the following files:

• Alice.java – An application program that uses the go-back-n reliable data transfer protocol to send and receive messages. It sends and receives messages forever in a while loop. In each iteration, it sends two messages to Bob and blocking reads on an incoming message from Bob.

• Bob.java - An application program that uses the go-back-n reliable data transfer protocol to send and receive messages. It sends and receives messages forever in a while loop. In each iteration, it sends one message to Alice and blocking reads twice on incoming messages from Alice.

• ByteArrayUtils.java – implements utility methods that convert byte array to integer and vice versa (same as that in project 1).

• NetworkLayer.java – This class simulates the lossy channel that the reliable data transfer protocol operates on.

• Packet.java – The class that defines the structure of the packet, i.e., the transmission unit of the go-back-n transport layer protocol. Encoding and decoding methods are also provided. This class is very similar to the Frame class in project 1. The major difference is that the Packet class now implements the timer management functionality because every data packet may need to be retransmitted and the go-back-n protocol may have multiple outstanding packets. On sending a data packet, a timer is started. If an acknowledgement is received before the timer expires, the timer is cancelled. If the timer expires, the packet is retransmitted, together with all other outstanding packets.

• TransportLayer.java – The class that implements the go-back-n reliable data transfer protocol. Unlike the PAR protocol in project 1, the go-back-n protocol supports duplex communication. Therefore, we do not distinguish sender from receiver. The reference implementation differs from the FSM specification slightly in that every packet is associated with a timer instead of one per window. This deviation is done purely out of convenience and it does not change the nature of the protocol.

How to run the reference implementation binaries:

• Download the jar file (gobackn.jar) for the reference implementation and expand it in your working directory:

jar xf par.jar

• Then, start Alice and Bob in two different terminals:

java Alice

java Bob

As soon as both processes are started, they start to communicate with each other. The following are example output from Alice and Bob:

From Alice:

>>>App:[Alice]-(0): It is a nice day.

>>>App:[Alice]-(1): It is a nice day.

TL:Send: seq=0, ack=7, len=30 "[Alice]-(0): It is a nice day."

...start timer for packet: seq=0, ack=7, len=30

TL:Send: seq=1, ack=7, len=30 "[Alice]-(1): It is a nice day."

...start timer for packet: seq=1, ack=7, len=30

...timeout for packet: seq=0, ack=7, len=30

TL:Send: seq=0, ack=7, len=30 "[Alice]-(0): It is a nice day."

...start timer for packet: seq=0, ack=7, len=30

TL:Send: seq=1, ack=7, len=30 "[Alice]-(1): It is a nice day."

...start timer for packet: seq=1, ack=7, len=30

RecvWin: 0...0 [0] SendWin: 0...1 [7]

...timeout for packet: seq=0, ack=7, len=30

App:[Bob]-(0): It is a nice day indeed.

TL:Send: seq=0, ack=7, len=35 "[Bob]-(0): It is a nice day indeed."

...start timer for packet: seq=0, ack=7, len=35

RecvWin: 0...0 [2] SendWin: 0...0 [0]

...cancel timer for packet: seq=0, ack=7, len=35

RecvWin: 0...0 [3] SendWin: closed [0]

RecvWin: 0...0 [0] SendWin: closed [7]

RecvWin: 1...1 [1] SendWin: closed [7]

RecvWin: 2...2 [2] SendWin: closed [0]

RecvWin: 3...3 [3] SendWin: closed [0]

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download