本文实例为大家分享了python实现UDP文件传输的具体代码,供大家参考,具体内容如下
UDP协议下文件传输:
服务端
import socket
count = 0
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_addr = ('127.0.0.1',9999)
s.bind(server_addr)
print('Bind UDP on 9999...')
while True:
if count == 0:
data,client_addr = s.recvfrom(1024)
print('conne
1