Hi all, I write a little program that sends file from client to server trough udp socket connection.. the program works correctly but if the file I transfer is larger than 8192 kb the stream stops and the file I receive is corrupt.. How can I avoid this limitation?
server.py
host = ...
port = ...
filename = ...
buf = 2048
addr = (host, port)
UDPSock = socket(AF_INET, SOCK_DGRAM)
UDPSock.bind(addr)
f = open(filename, 'wb')
block,addr = UDPSock.recvfrom(buf)
while block:
if(block == "!END"): # I put "!END" to interrupt the listener
break
f.write(block)
block,addr = UDPSock.recvfrom(buf)
f.close()
UDPSock.close()
client.py
host = ...
port = ...
filename = ...
buf = 2048
addr = (host, port)
UDPSock = socket(AF_INET, SOCK_DGRAM)
f = open(filename, 'rb')
block = f.read(buf)
while block:
UDPSock.sendto(block, addr)
block = f.read(buf)
UDPSock.sendto("!END", addr)
f.close()
UDPSock.close()