Udp套接字
from socket import *
udp_socket = socket(AF_INET, SOCK_DGRAM)
address = ("xxx.xxx.x.xx", 端口号)
udp_socket.bind(("xxx.xxx.x.xx", 端口号))
date = (input("请输入你输入的内容")).encode("gbk")
udp_socket.sendto(date, address)
recv_date, ip_port = udp_socket.recvfrom(1024)
print("接收的数据是", recv_date.decode("gbk"), "来自", ip_port)
udp_socket.close()