Commit 48a25183 authored by wx002's avatar wx002

clean and updated readme

parent ddd6e127
This is implementation of RDT (Reliable Data Transfer) protocol over UDP.
Running instructions:
0. Run with respective commandline arguments. Addr=, port=8880, remote_port=8888
0. Run with respective commandline arguments. addr=, port=8880, remote_port=8888
1. Run Parameters: --addr (the address to listen to, default=, --port (the port to listen to, default=8888)
2. run Parameters: --remote_addr(the remote address to send file to, default=, --remote_port (the remote port to send file to, default=8880), --file (the file that will be sending, default=sendData/alice.txt)
-SendData: File to send should be located in here
-recvData: The file received will be located here, named recv.txt
The default configuration is meant to run with the udp_box, in the following configuration: <-> <->
......@@ -35,12 +38,19 @@ Pros:
- Ensures data is correctly transferee
- There is almost no chance of data error
- Packets arrive in sequential order
- Very reliable when the connection is decent, performs well within reasonable amount of time
- Will be able to run and sustain even under terrible conditions, with almost no data error
- It is not using the maximum bandwidth at all
- Transfer rate is very low since is sending lines
- It require insane amount of time with non ideal conditions
- Under terrible conditions, the transfer will last indefinitely
- Not taking advantage of the full bandwidth
Possible additions:
- Add initial handshakes for the receiver to know what to name the file
- Add timeout phase to break out indefinite run times with terrible connection
- Consider revamping the algorithm to use more bandwidth
Protocol sequence diagram:
Sender Receiver
......@@ -79,6 +79,8 @@ def verify_packet_content(stringList):
startTime =
print('established connection with server, waiting to receive...')
while True:
data, addr = sock.recvfrom(1048)
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -6,6 +6,11 @@ import sys
import argparse
def PrintException():
Print detail exception details
taken from:
exc_type, exc_obj, tb = sys.exc_info()
f = tb.tb_frame
lineno = tb.tb_lineno
......@@ -40,6 +45,7 @@ def build_packet(index, line):
hashed_line = hash_index + hash_str + line.encode()
return hashed_line
def rdt_sendFile(network, dest, filename, size=65536):
# generate lines from file
file = open(filename)
......@@ -112,5 +118,6 @@ if __name__ == '__main__':
timeOut = 10
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
filename = 'sendData/alice.txt'
rdt_sendFile(sock, dest, filename)
file_name = 'alice.txt'
filepath = 'sendData/'+file_name
rdt_sendFile(sock, dest, filepath)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment