复制
收藏
提问
全网
import socket UDP_PORT = 6666 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(('', UDP_PORT)) while True: data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes print("received message from %s: %s" % (addr, data.decode()))注释
2个月前
理解问题import socket UDP_PORT = 6666 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(('', UDP_PORT)) while True: data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes print("received message from %s: %s" % (addr, data.decode()))注释
已完成理解「import socket UDP_PORT = 6666 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(('', UDP_PORT)) while True: data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes print("received message from %s: %s" % (addr, data.decode()))注释」
展开阅读网页
更专业一些
转笔记
专业
import socket
UDP_PORT = 6666
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('', UDP_PORT))
while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
print("received message from %s: %s" % (addr, data.decode()))注释不在提醒