Assignment #1 Due: Oct 21,2005 12 - 1 pm ENG 201 and ENG 202

 

Write a program to simulate a Stop-and-wait ARQ. This protocol should groups of asynchronous characters together for transmission and compute a checksum, which is appended to the end of the block.

The checksum is obtained by first taking the sum of the ASCII value of each data character in the block and dividing that sum by 255. Then the quotient is discarded and the remainder is appended to the block as the checksum.

The receiving device performs the same operation and this "Internally" generated checksum is compared to the transmitted checksum. If the two checksums match, the block is considered to have been received error-free.

You need to implement all aspects of the Data link layer.

There should be Line control, Flow control, and error control.

 

Format of the Frame:

First byte:   Start of header ASCII SOH: 00000001

Next byte:   Block number or Sequence number

Next byte:   One's complement Obtained by subtracting block number from 255.

Next byte: Checksum value

Followed by 128 characters of data.

Size of frame:   132

 

Error detection

1. If SOH is damaged send back a NAK.

2. If the block number or the one's complement is damaged, they will not be one's complement of each other. Send backs a NAK.

3. Checksum produced by the receiver does not match the transmitted value, transmit a NAK.

* For all three situations the negative acknowledgement will serve as a request to the transmitting station to retransmit the previously transmitted block.

You need to demonstrate error handling in the following situations:

  1. Damaged Frame 2. Lost Ack 3. Lost NAK.

    Error checking to be demonstrated by use of signals
    (ie ^C � Damaged Frame ^Z � Lost ACK ^\ - Lost NAK)

You need to have a "layer" that sits on top of this layer.

The job of this layer is "End-to-End" transmission.

At the sender's end: read a line of text from a file.

At the reciver's end: discard duplicates,reorder frames and write to a file.

Simulate the physical layer by the use of "pipes".



Marks & Submission Instructions