首页 > 学院 > 开发设计 > 正文

pyzmq简单的在线聊天室

2019-11-14 17:15:45
字体:
来源:转载
供稿:网友
#encoding=utf-8
#客户端
import zmqc = zmq.Context()s = c.socket(zmq.REQ)s.connect('tcp://127.0.0.1:10001')while True: s.send(raw_input('客户端输入:'), copy=False) msg2 = s.recv(copy=False) PRint "服务器的数据:",msg2

#encoding=utf-8
#服务器
import zmqc = zmq.Context()s = c.socket(zmq.REP)s.bind('tcp://127.0.0.1:10001')while True: msg = s.recv(copy=False) print "客户端的数据:",msg s.send(raw_input("服务器输入:"))

 


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表