标签:bin sock code IV hello data ... address int
1 import socket 2 import threading 3 4 address = (‘0.0.0.0‘, 8000) 5 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 6 s.bind(address) 7 print(‘8000端口在监听...‘) 8 while True: 9 data, attr = s.recvfrom(1024) 10 print(‘接受到来自{}:{}的数据:{}‘.format(attr[0], attr[1], data.decode())) 11 s.sendto(‘hello, {}‘.format(data.decode()).encode(), attr)
标签:bin sock code IV hello data ... address int
原文地址:https://www.cnblogs.com/AIEIKE/p/9226615.html