This commit is contained in:
yumoqing 2021-06-17 15:49:17 +08:00
parent 35eceb8676
commit 2b0c6dec6a

View File

@ -53,3 +53,15 @@ class UdpComm:
b = json.dumps(data).encode('utf-8')
for addr in addrs:
self.udpSerSock.sendto(b,addr)
if __name__ == '__main__':
import sys
def msg_handle(data, addr):
print('addr:', addr, 'data=', data)
d = UdpComm(50000, msg_handle)
x = input()
while x:
d.broadcast(x)
x = input()