You are on page 1of 3

Project Title: Reliable Data Transfer Protocol using UDP

Introduction
In this project, I implemented a reliable data transfer protocol using UDP. The purpuss of this

project was to creat a protocol that could handle packet loss and retransmition, while also properly

handling the various states and events of the protocol.

Design and Implementation

I began by creating a skeleton class for both the Sender and Receiver, along with an STPPacket

class to serve as the base segment structure for all segments. I included essential variables and

methods for packet creation, segment receipt, and connection termination. Additionally, I

implemented the feature for maximum segment size by adding a split_data() method to extract a

specific number of bytes from the app-layer file and appending them to the segment payload before

sending them over UDP. I verified this functionality by testing various new_max values and

ensuring that each packet was correctly divided by the new_max value and that all separated

packets were delivered without any errors.

I added methods to generate SYN, SYNACK, ACK, FIN segments and included logic to increase

the sequence and acknowledgement numbers for both the Sender and Receiver. Furthermore, I

developed a Packet Loss Drop (PLD) class and included a method to drop or send packets based on

a pseudo-random number. I verified this feature by selecting different PLD values and verifying that

packets were being dropped, as evidenced by the log output.

I implemented a Timer feature using the time.clock() function to maintain the current time and aid

in timeout and retransmission. I validated this feature by conducting tests involving dropped

packages, whereby all dropped packages had a constant timeout value before being retransmitted. I

also ensured that the main methods on both the Sender and Receiver sides held everything together.

During the ESTABLISHED CONNECTION state, the Sender obtained data from the app-layer file,

created new packets based on the new_max value, parsed them through the PLD system, and

transmitted them to the Receiver for processing.


The Receiver listened for Data segments, generated corresponding ACKs, and extracted payload.

The Sender and Receiver went through the 3-way-handshake before moving to an ESTABLISHED

CONNECTION state.

Testing

During my testing phase of the project, I used Python 3.9 in my local environment to test the

protocol. I tested the protocol using different packet sizes and packet loss scenarios by changing the

new_max and PLD values. I also tested the Timer feature by purposely dropping packets and

checking if they were retransmitted after a set timeout value. The tests confirmed that the protocol

was capable of handling different scenarios and was reliable in transferring data over UDP. Overall,

I found the testing phase to be successful and it helped me ensure that the protocol was ready for

implementation.

Conclusion

In conclusion , I successfully completed a coding project within the given timeframe. I created a

Sender and Receiver class, along with an STPPacket class for packet structure. I implemented

features such as maximum segment size, packet loss, and a timer for retransmission.

You might also like