Programming Assignment 2 -- Computer Networks
Computer Networks
Spring, 2001
due: March 23 (5 pm)
The objective of this assignment is to simulate the error checking and flow control of the data link layer. You will write three components, each one simulating a different layer of the OSI model.
1. GPLP server. The Garbled Physical Layer Protocol server will simulate a noisy physical link between two hosts. One GPLP server will run on each of the two hosts. The two servers will communicate through datagram sockets.
The server will be started by a command line in the form
gplp hostaddr p1 p2 p3
where
hostaddr is the ip address of the host at the other end of the link.
p1 is the probability of a garbled bit. (A garbled bit should
be replaced by a random bit.)
p2 is the probability that the bit immediately following a garbled
bit is also garbled.
p3 is the probability that a frame is lost.
The server listens for messages on its socket. Messages arriving from its peer server are sent (using the same socket) to the data link layer simulator on the local host. Messages arriving from anywhere else are garbled, then sent to the peer server on the remote host.
Use a random number generator to generate errors with the designated
probabilities.
2. Data link simulator. The data link simulator running on one host passes messages from the application program on the local host to the data link simulator on the remote host, by using the local GPLP server.
The data link simulator uses a datagram socket for communication. Messages received from the local application are enclosed in frames and then sent to the GPLP server. Messages received from the GPLP server are processed by the data link algorithm and (if valid) passed on to the application.
Use the “Go Back N” method for error control and flow control. The objective is to provide a reliable channel to the application layer.
Use the following frame format:
bytes
1 message type (0=data, 1=ACK, 2=NACK)
2 sequence number
3-(n-4) payload
(n-3),(n-2) CRC code
Limit the frame size to a maximum of 100 bytes.
Your data link program should create a log file describing the frames that it processes. When it terminates, it should write a summary, including:
Number of frames read
Number of frames read containing bit errors
Number of duplicate frames received
Number of out-of-order frames received
Number of frames passed to the application layer
Number of distinct frames written
Number of duplicate frames written
3. Application program. Write a simple
application
program which will use your data link layer. Some possibilities
are
an echo server, adapting your rfq server from program 1, or a simple
chat
program.
Testing
Test your program for a variety of error probabilities.
Collect
the resulting statistics and load them into a spreadsheet for
analysis.
Write a report describing the conclusions you draw from the results.