[zeromq-dev] Pyzmq - messaging between stream sockets

Matej Puk puk.matej at gmail.com
Thu Nov 9 20:11:18 CET 2017


Hi,

I would like to ask if messaging between two stream sockets is possible. I
was trying to implement simple example but outcome was strange. Following
are two apps run separately.

*sender.py*

import zmq

context = zmq.Context()
socket = context.socket(zmq.STREAM)
socket.bind("tcp://*:5555")

socket.connect("tcp://localhost:5556")
socket.send("message")

*receiver.py*

import zmq

context = zmq.Context()
socket = context.socket(zmq.STREAM)
socket.bind("tcp://*:5556")

message = socket.recv()print("Received -> [ %s ]" % (message))

*Output*

Received -> [ b'\x00k\x8bEg' ]Received -> [ b'' ]

I was experimenting with this because I want to implement enviroment
where one entity can recieve

messages and also send messages to multiple targets.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20171109/1623fbbe/attachment.htm>


More information about the zeromq-dev mailing list