#encoding=utf-8
#客户端
import zmq c = 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 zmq c = 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("服务器输入:"))