Answered You can hire a professional tutor to get the answer.
Programming Assignment 2 COEN 233 Computer Networks - Winter Quarter 2016 Part 2: You should make the changes and add the new requirements on top of...
the programming language is c
Programming Assignment 2
COEN 233 Computer Networks - Winter Quarter 2016
Part 2: Reliable Transfer over an Unreliable Channel with Bit Errors that can also loose packets
This project is a continuation of the 1st programming assignment. You should make the changes and add the new requirements on top of it.
It consists of building a Stop and Wait (S&W) reliable protocol. The S&W is going to be built on top of UDP, and it is supposed to provide a reliable transport service to the SFTP application (developed in part 1, which needs to change to call your new send and receive functions). Messages are sent one at a time, and each message needs to be acknowledged when received, before a new message can be sent.
The S&W consists of a client and a server. Communication is unidirectional, i.e., data flows from the client to the server. The server starts first and waits for messages. The client starts the communication. Messages have sequence number 0 or 1. Before sending each message, a checksum is calculated and added to the S&W header. After sending each message, the client starts a timer (use alarm or sleep). When the timer goes off, the client tries to read a corresponding ACK message. If the corresponding ACK is not there, or it is not the corresponding ACK (or if the checksum does not match), the message is sent again and the timer is started again. If the corresponding ACK is there, the client changes the state and returns to the application which can now send one more message. This means that the program blocks on writes.
The server, after receiving a message, checks its checksum. If the message is correct and has the right sequence number, the server sends an ACK0 or ACK1 message (according to the sequence number) to the client, changes state accordingly, and deliver data to the application.
If the message is not correct, the server repeats the last ACK message.
The protocol should deal properly with duplicate data messages and duplicate ACK messages.
The S&W message contains the header and the application data. No reordering is necessary, since the S&W is sending the exact message given by the application, one by one.
To verify your protocol, use the result of a random function to decide to send or skip a message, to decide to send or skip an ACK message, and to decide whether to send the right checksum or just zero. This will fake the packet error and loss of a packet effect.
Fig. 1: Receiver
Fig. 2: Sender