TCP and UDP Implementation
Budget: $30 – $250 USD
This version of your project will implement the text file exchange using stop-and-wait reliability over UDP. As a reminder, UDP provides best-effort packet delivery service; you will have to implement reliabilitv checks on tap of UDP to ensure that your data is successfully transmitted between the server and the client. Since we are working at the application level, we will implement our stop and wait reliability at the level of message chunks. We will discuss this functionality in terms of sender and receiver. Note that depending an whether you are performing get or put your sender and receiver will switch places in the client-server architecture (i.e. for
get, v ur sender will be the server and your receiver will be the client, whereas for put, the sender will be the client whereas the receiver will be the server). The reliable data transfer should function identicall v for both get and put. Your reliable protocol will function as follows:
o First, the sender calculates the amount of data to be transmitted and sends a “length” message to the receiver, letting them know how many bytes of data to expect. The length message should contain the string LEN : Bytes.
Second, the sender splits the data into equal chunks of 1000 bytes each, and proceeds to send the data one chunk at a time. Note that the last chunk might be smaller than 1000 Bytes and that is OK. Your programs should be able to handle arbitrary text file sizes. After transmitting each chunk, the sender stops and waits for an acknowledgement from the receiver. To this end, the receiver has to craft and send a special message containing the string ACK.
O Finally, once the receiver receives all expected bytes (as per the LEN message), the receiver will craft a special message containing the string FAN. This message will trigger connection termination.
O Timeouts. Note that there are a few points in the sender-receiver interaction where a timeout might occur. The below description specifies how your program should behave in a timeout.
• Timeout after LEN message. If no data arrives at the receiver within one second from the reception of a LEN message, the receiver program should terminate, displaying “D1d not rece1 ve data.
Terminating.”
• Timeout after a data packet. If no ACK is received by the sender within one second from transmitting a data packet, the sender will terminate, displaying “D1d not receive ACK. terminating.”
• Timeout after ACK. If no data is received bv the receiver within one second of issuing an ACK, the receiver will terminate, displaying “Data transmission terminated prematurely.”.
get, v ur sender will be the server and your receiver will be the client, whereas for put, the sender will be the client whereas the receiver will be the server). The reliable data transfer should function identicall v for both get and put. Your reliable protocol will function as follows:
o First, the sender calculates the amount of data to be transmitted and sends a “length” message to the receiver, letting them know how many bytes of data to expect. The length message should contain the string LEN : Bytes.
Second, the sender splits the data into equal chunks of 1000 bytes each, and proceeds to send the data one chunk at a time. Note that the last chunk might be smaller than 1000 Bytes and that is OK. Your programs should be able to handle arbitrary text file sizes. After transmitting each chunk, the sender stops and waits for an acknowledgement from the receiver. To this end, the receiver has to craft and send a special message containing the string ACK.
O Finally, once the receiver receives all expected bytes (as per the LEN message), the receiver will craft a special message containing the string FAN. This message will trigger connection termination.
O Timeouts. Note that there are a few points in the sender-receiver interaction where a timeout might occur. The below description specifies how your program should behave in a timeout.
• Timeout after LEN message. If no data arrives at the receiver within one second from the reception of a LEN message, the receiver program should terminate, displaying “D1d not rece1 ve data.
Terminating.”
• Timeout after a data packet. If no ACK is received by the sender within one second from transmitting a data packet, the sender will terminate, displaying “D1d not receive ACK. terminating.”
• Timeout after ACK. If no data is received bv the receiver within one second of issuing an ACK, the receiver will terminate, displaying “Data transmission terminated prematurely.”.