In: Computer Science
Could you give me some solving about the following question?
question 1 Design a pair of UDP based large file transmission programs using python. Transmitted file size should be over 100mb, Limitations: only os, socket, struct, hashlib, math, tqdm, File check is required after transmission
Splitting the text file into chunks of data would help to send large amounts of data.
Client:
import socket as s
sckt=s.socket(s.AF_INET, s.SOCK_DGRAM)
serv_addr=(SERVER_ADDRESS, APP_PORT)
file_name='LargeFile.txt'
f=open(filename,'r')
word=""
while 1:
ch = f.read(1)
if not ch:
sckt.sendto(word,serv_addr)
break
elif len(word<=1024):
word=word+ch
else:
sckt.sendto(word,serv_addr)
word=""
f.close()
Server:
import socket as s
servsckt=s.socket(s.AF_INET, s.SOCK_STREAM)
servsckt.bind((SERVER_ADDRESS, APP_PORT))
f=open(output.txt,'')
while True:
word, addr = servsckt.recvfrom(1024)
f.write(word)
f.close()
A char to char file comparison can be written for checking the contents of file