首页 > 代码库 > python_socket
python_socket
# socket_server.pyimport sockets = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)s.bind((‘‘,8089))while True:# Receive up to 1,024 bytes in a datagramdata, addr = s.recvfrom(1024)print "Received:", data, "from", addr
# socket_client.pyimport sockets = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)port = 8089host = "localhost"while True:msg = raw_input(‘Enter message:‘)s.sendto(msg, (host, port))
python_socket
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。