Assignment3: Transport Layer -> Reliable Data Transfer CS390 Data Networking YOU MAY WORK WITH A PARTNER // GO-BACK-N IS EXTRA CREDIT In this assignment you and your partner will explore the stop and wait, selective repeat reliable, and go-back-n (extra credit) data transfer protocols. For each protocol create a sender which breaks up a 10M file into 1K segments and sends the segments to the receiver. Each time a segment is sent the probability that a segment will: - arrive okay 70% not arrive (use a timeout) 10% be corrupted (use a random bit error) 10% arrive out of order (use a sequence number) 10% at the receiver. After the receiver has received to segment the receiver will send a response (ack/nack ). Each time the ack/nack is sent to probability that the ack/nack will: - arrive okay 70% not arrive (use a timeout) 10% be corrupted ( use a random bit error) 10% arrive out of order (use a sequence number) 10% For each protocol, write a sender and receiver that handles reliable data transfer. If you are working with a partner, you and your partner should divide the work up so that one partner writes the sender and the other partner writes the receiver. You should try to realistically simulate unreliable data transfer: - to simulate a segment that does not arrive at the receiver: For the stop and wait protocol you should not send the segment to the receiver and have the absence of an ack from the receiver trigger a timeout. Follow this link to see how to test for a timeout on a receive: http://stackoverflow.com/questions/30395258/setting-timeout-to-recv-function For sliding window protocols it is more challenging because you need to be able to have multiple in flight segments… and if each segment send is followed by a recv for the ack, you won’t be able to the send the next segment after the lost segment until the recv for the lost segment’s ack times out... unless you use threads (a different course) so this reduces to stop and wait… not good. So for the sliding window protocols send a segment to the receiver with a flag that marks the segment as “YOU AREN’T SUPPOSED TO GET THIS”, then have the receiver send back an ack that says to the sender “I DIDN’T GET THE SEGMENT”. Deal with the simulated timeout after the rest of the segments in the window have been sent. - to simulate a corrupted segment you should generate a random bit error in the segment and have the receiver detect the bit error through a checksum. - to simulate a segment which arrives out of order you should include a sequence number in each segment and transmit a segment with the wrong sequence number two receiver. Provide feedback in your program for the protocol. For no error, have the sender/receiver print out the action that was taken when a segment/ack is send/received. Have the sender/receiver print out the TYPE of unreliable data transfer detected, then print out the action taken to deal with the unreliable data transfer. For example (stop and wait): Receiver: Receiver: Receiver: resending segment corrupted, bad checksum, sending nack segment 42 received, sending ack42 segment 42 received, duplicate segment, ignoring, ack42
© Copyright 2026 Paperzz