Questions tagged [pyzmq]

PyZMQ is the Python bindings for 0MQ (also spelled ZeroMQ, ØMQ or ZMQ), written almost entirely in Cython

Python bindings for 0MQ, a high-performance asynchronous messaging library aimed at use in scalable distributed or concurrent applications. It provides a message queue, but unlike message-oriented middleware, a 0MQ system runs without a dedicated message broker.

For a brief introduction read the ZeroMQ concept & properties from

PyZMQ works with Python 3 (≥ 3.3), and Python 2.7, with no transformations or 2to3, as well as PyPy (at least 2.0 beta), via CFFI.

PyZMQ started it python journey since the ZeroMQ API v2.1.1, those days in Python 2.6

Useful links:

542 questions
46
votes
1 answer

ZeroMQ/ZMQ Push/Pull pattern usefulness

In experimenting with the ZeroMQ Push/Pull (what they call Pipeline) socket type, I'm having difficulty understanding the utility of this pattern. It's billed as a "load-balancer". Given a single server sending tasks to a number of workers,…
CNK
  • 953
  • 1
  • 10
  • 17
30
votes
5 answers

Connecting to a remote IPython instance

I would like to run an IPython instance on one machine and connect to it (over LAN) from a different process (to run some python commands). I understand that it is possible with zmq : http://ipython.org/ipython-doc/dev/development/ipythonzmq.html…
Ohad
  • 1,280
  • 4
  • 16
  • 25
20
votes
4 answers

ZeroMQ Message Size Length Limit?

Suppose that several machines are interacting together using python's zeroMQ client. These messages are naturally formatted as strings. Is there a limit to the length of a message (string)?
user3262424
  • 6,619
  • 10
  • 46
  • 78
14
votes
6 answers

ZeroMQ PUB socket buffers all my out going data when it is connecting

I noticed that a zeromq PUB socket will buffers all outgoing data if it is connecting, for example import zmq import time context = zmq.Context() # create a PUB socket pub = context.socket (zmq.PUB) pub.connect("tcp://127.0.0.1:5566") # push some…
Fang-Pen Lin
  • 10,892
  • 13
  • 59
  • 90
13
votes
3 answers

Python + ZMQ: Operation cannot be accomplished in current state

I am trying to get a python program to communicate with another python program via zeromq by using the request-reply pattern. The client program should send a request to the server program which replies. I have two servers such that when one server…
QuikProBroNa
  • 706
  • 2
  • 7
  • 22
12
votes
1 answer

Why does (Py)ZeroMQ open so many Unix socket files?

I tried to monitor the number of open Unix socket files with lsof -U | wc -l while I executed this code: >>> import zmq # 1375 Unix socket files >>> c = zmq.Context() # 1377 Unix socket files >>> s = c.socket(zmq.PUSH) # 1383 Unix socket files >>>…
Peque
  • 10,375
  • 7
  • 48
  • 83
11
votes
4 answers

C++ and Python ZeroMQ 4.x PUB/SUB example does not work

I can only find old C++ source examples. Anyways, I did mine, based on them. Here's my publisher in python: import zmq context = zmq.Context() socket = context.socket(zmq.PUB) socket.bind("tcp://*:5563") while True: msg = "hello" …
Lucas Zanella
  • 223
  • 9
  • 35
11
votes
1 answer

How to check whether python package is installed or not in Docker?

I used Dockerfile successfully built a container. However, my code doesn't work in the container. It does work if I install all the packages manually. I'm assuming I messed up something that cause docker didn't install the packages properly. So, I…
Bruce Yong Li
  • 806
  • 1
  • 8
  • 20
11
votes
1 answer

zmq send with NOBLOCK raise Resource temporarily unavailable

This code will raise Resource temporarily unavailable when call with NOBLOCK: context = zmq.Context() sender = context.socket(zmq.PUSH) sender.bind('tcp://*:15556') sender.send('KeEpAliv', zmq.NOBLOCK) # this line will throw…
schemacs
  • 2,218
  • 5
  • 30
  • 48
11
votes
2 answers

ZMQ REP, knowing who send the request

I m currently using zmq with python. Server is using REP socket. Do I have a way, when recv a message, to know who send it ? If a receive 2 messages, I just need to know if they come from the same user or not, so an uid for example would be enough.…
user1572602
  • 354
  • 3
  • 8
11
votes
1 answer

zeromq and bind_to_random_port - how to get port chosen

In python, I am using the following: context = zmq.Context() socket = context.socket(zmq.PUSH) socket.bind_to_random_port('tcp://*', min_port=6001, max_port=6004, max_tries=100) port_selected = socket.??????? How do I know what port…
Tampa
  • 62,379
  • 105
  • 250
  • 388
10
votes
1 answer

ZeroMQ failing to communicate between two Docker containers

I'm trying to set up a toy example of Docker networking with ZeroMQ in macOS, where the serverd.py sends a message to the clientd.py and the client simply displays it using PUSH/PULL. If I run them outside of the container they work fine, but I'm…
Jimmy C
  • 7,334
  • 9
  • 37
  • 54
9
votes
2 answers

How to fix 'Install tornado itself to use zmq with the tornado IOLoop.' warning in Python

I've been following this (https://developer.ibm.com/tutorials/se-distributed-apps-zeromq-part2/) tutorial for setting up a ZeroMQ client/server setup which uses CurveZMQ to encrypt messages. The code works, however whenever I run either the client…
Logan Davenport
  • 161
  • 1
  • 2
  • 6
9
votes
3 answers

ZeroMQ REQ/REP server error handling

I am trying to use the ZeroMQ rep/req and cannot figure out how to handle server side errors. Look at the code from here: socket.bind("tcp://*:%s" % port) while True: # Wait for next request from client message = socket.recv() print…
Tom Bennett
  • 1,601
  • 3
  • 17
  • 28
9
votes
1 answer

Sharing data using pyzmq zero-copy

I stumbled on zeromq when searching for an efficient solution to IPC in python; I have a couple of python processes which need to do some cpu intensive processing on data from a dict in a master process. These worker processes only read from the…
Martijnh
  • 163
  • 8
1
2 3
36 37