import socket
import time
HOST = ''
PORT = 12456
ADDR = (HOST, PORT)
bufferSize = 1024
udpSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
udpSock.bind(ADDR)
while True:
print 'waiting for message...'
data, addr = udpSock.recvfrom(bufferSize)
if not data:
break
data = str.upper(data)
udpSock.sendto(data, addr)
udpSock.close()
Python网络编程--UDP Server
最新推荐文章于 2024-10-15 13:48:38 发布