-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
@ashishrv thanks for this documentation.
I was trying to run the client-server example, but after I run the two scripts pairserver.py and pairclient.py I can't see the messages printed in the shell. Nothing is printed. The scripts are:
pairserver.py
import zmq
import random
import sys
import time
port = "5556"
if len(sys.argv) > 1:
port = sys.argv[1]
int(port)
context = zmq.Context()
socket = context.socket(zmq.PAIR)
socket.bind("tcp://*:%s" % port)
while True:
socket.send_string("Server message to client3")
msg = socket.recv()
print(msg)
time.sleep(1)
pairclient.py
import zmq
import random
import sys
import time
port = "5556"
if len(sys.argv) > 1:
port = sys.argv[1]
int(port)
context = zmq.Context()
socket = context.socket(zmq.PAIR)
socket.connect("tcp://localhost:%s" % port)
while True:
msg = socket.recv()
print(msg)
socket.send_string("client message to server1")
socket.send_string("client message to server2")
time.sleep(1)
My python and pyzmq versions are:
Python 3.6.1 (default, Apr 4 2017, 09:40:21)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
>>> import zmq
>>> zmq.__version__
'16.0.2'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels