Homework Number 1
ELE543, Computer Networks

  • Last time modified: Sept. 23, 1999

  • Objectives:
    1. Practicing Simple Data Link (TCP) Protocols, framing, and error control techniques;
    2. Learning to write simple Java programs.

  • Due date: Oct. 18th at 9AM. Overdue penalty: 5% deduction per business day.
  • Grading: 15% of final grade.
  • Requirements:

    Write a Java program to implement (simulate) both serial communication and sliding window protocol. Your program should consist of two threads (or processes) representing sender and receiver respectively. Each thread has two separate layers, one for physical layer (similar to RS232) and the other for data link layer (sliding window protocol). The data link layer takes a text file, forms packets with frame information, and pass them to the physical layer. The physical layer converts the text of a frame into ASCII formats, attaches parity and delimiters, and transmits character by character to the receiver. The two layers at the receiver side do the oposite function as the sender.

  • Specifications:
    1. The basic signals that the sender and the receiver can recognize are "0" and "1".
    2. The physical layer module of the sender takes a frame of a bit stream from the upper data link layer, transmits the bit stream to the receiver bit by bit. The physical layer module of the receiver does the opposite.
    3. Data are transimited using ASCII code with 8 bit data and no parity.
    4. The buffer size at the sender side is assumed to be 1K Byte and is the same as at the receiver side. The frame length at the data link layer can be either 64Bytes or same as buffer size.
    5. A frame should start with character soh (01), followed by a 1-byte sequence number, data field with FF (11111111) stuffing, and end by character eot (04).
    6. For error control, your datalink layer program should compute and append a CRC code to each frame to be transmitted. The CRC code should be able to detect all possible bursty errors of lenth 8, and all possbile odd number of errors. The sender should encode the CRC checksum and the receiver should decode the checksum.
    7. The data link layer of your program should use selective repeat protocol with window size depending on frame size.
    8. Your receiver program should take an argument which is a string of 0, 1, and * with the following meaning
      1. 0: NAK, negative ackhowledgement;
      2. 1: ACK; positive acknowledgement;
      3. *: no acknowledgement sent.
      e.g. if the argument is 110*, the receiver should send a positive acknowledgment for each of the first two frames received, send a negative acknowledgement for the third frame received, and send no acknowledgement for the fourth frame received. The purpose here is to simulate a realistic channel that may cause transmission error, lose data, or lose acknolowgements.
    9. Your sender program should also be able to take binary streams from a user in order to test functions of your program such as error detection and acknowledgements, etc. If a binary bit stream is to be transmited, it should bypass the datalink layer and physical layer of the sender program. The binary bit stream should go directly to the communicaiton link such as a socket.


      Note: Item 8 is needed to test your sender program and item 9 is used to test your receiver program.

    10. You may use DatagramSocket/DatagramPacket or ServerSocket/Socket pairs to implement the communication link, and Server/Client as sender/receiver. An Applet may be used to provide interface to the user.
    11. Your program should display the transmission process at both layers through Graphic User Interface.
    12. You may make any reasonable assumptions in your program for functions that are not specified here.

  • Some hints to the homework
    1. Use an Applet similar to the QuoteClientApplet in the Applet section of the tutorial to implement your receiver;
    2. Use an application class similar to the QuoteServer in the networking section to implement your sender;
    3. Send all w frames before trying to receive an ack from the receiver; Receive method will block if no packet is received. To wake up the receive method, simply implement a loop (timer) that sends a blank frame, when time out, to the socket where the receive method is blocked.
    4. There is a C program that implements the sliding window protocol in the text book.

  • Computer Facilities in Department or Electrical and Computer Engineering

    Please send your comments to Dr. Qing Yang