Questions tagged [pyzmq]

5

votes
1

answer
42

Views

Create a group of streamers and publishers

I have a number of nodes that will use a secondary service to be informed about the address of each other. I want to be able to publish information so as all the other nodes can hear it. Using an XPUB socket is not an option I would want to go with here as I want this system to be distributed. What...
dearn44
1

votes
1

answer
514

Views

ZeroMQ Subscribers not receiving message from Publisher over an inproc: transport class

I am fairly new to pyzmq. I am trying to understand inproc: transport class and have created this sample example to play with. It looks a Publisher instance is publishing messages but Subscriber instances are not receiving any. In case I move Subscriber instances into a separate process and change i...
sachin
1

votes
1

answer
51

Views

Python ZMQ transmitting message garbled

My server in python: import time import zmq context = zmq.Context() socket = context.socket( zmq.REP ) socket.bind( 'tcp://*:5555' ) while True: # Wait for next request from client message = socket.recv() print( 'Received request: %s' % message ) # Do some 'work' time.sleep( 1 ) # Send reply bac...
Zixuan Zhang
1

votes
1

answer
351

Views

ZMQ subscriber does not receive message from remote server after long interval

The following pubsub php works normally when the both php are running in the same server. However, it does not work when they are running in the different servers. (local)client.php (local)server.php (with sleeptime 300)
zono
1

votes
1

answer
280

Views

How to use zmq inside a function (in a non-blocking manner) to obtain the function's state when requested by a client?

How to use ZMQ in a non-blocking manner to 'serve' the status of a long running job when the status is requested by a client? The below code illustrates how the long running task could be temporarily 'interrupted' to send the current status. The task is long running because there are many urls to pr...
Greg
1

votes
2

answer
110

Views

PyZMQ ( ZeroMQ ) - How to get a subscription key from a SUB-socket?

I would like to get the subscription key of a subscriber ( SUB ) socket after it has been set. Say I have the following socket : import zmq ctx = zmq.Context.instance() sub_sock = ctx.socket(zmq.SUB) sub_sock.bind('tcp://127.0.0.1:6667') sub_sock.setsockopt(zmq.SUBSCRIBE, 'foo1'.encode('ascii')) Wha...
NumesSanguis
1

votes
2

answer
74

Views

PyZMQ Dockerized pub sub - sub won't receive messages

I want to build a modularized system with modules communicating over ZeroMQ. To improve usability, I want to Dockerize (some) of these modules, so that users don't have to setup an environment. However, I cannot get a dockerized publisher to have its messaged received by a non-dockerized subscriber....
NumesSanguis
0

votes
0

answer
3

Views

Windows 7 Python 3.6.8 pip installed Spyder 3.3.2 throws a Kernel error - “zmq.error.zmqerror:bad address”

1) I first installed python 3.6.8 from https://www.python.org/downloads/release/python-368/ I have set the appropriate path variables (path (to python & Python scripts directory) & PYTHONPATH (to DLLs and Lib directory)) and double checked the version on cmd. It seems to work there. 2) I then instal...
absynth21
1

votes
0

answer
9

Views

Strange Issue when using pywin32 with zmq

Description: I want to seal python to Windows service. Then I use pywin32. My python scripts will use pyzmq. Everytime when I want to start the service,the service will be stopped after starting a few seconds. I try using 'try catch' to catch the exception in python code.It's useless. Then I try us...
David
1

votes
2

answer
602

Views

Data obtaining check PUB/SUB pattern

There is a server, that collects some data and then sends it to the client. I need to be sure that the client got the data sent by server. I thought PUB/SUB pattern here would be best choice, but I don't understand how to make check if client got the data? I heard something about reliable PUB/SUB, b...
dimazubrik
1

votes
2

answer
3.1k

Views

Can't install PyZMP for Python — Dependencies

I am having trouble installing the PyZMP dependency for iPython. I have tried a number of things such as using pip/brew, but ended up installing the package manually using this answer. Now, pip list packages yields the following pyzmq (14.2.0-dev) pyzmq-static (2.2) (I have also tried using pyzmq-st...
lennart
1

votes
2

answer
805

Views

Which protocol should I use for pyzmq?

I am working on a project where I have a client server model in python. I set up a server to monitor requests and send back data. PYZMQ supports: tcp, udp, pgm, epgm, inproc and ipc. I have been using tcp for interprocess communication, but have no idea what i should use for sending a request over t...
lacraig2
1

votes
1

answer
232

Views

0mq: pubsub latency continually growing with messages?

pub.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.PUB) socket.bind('tcp://*:%s' % port) topic = 10001 while True: msgdata = time.time() socket.send('%d %d' % (topic, msgdata)) p...
ealeon
1

votes
2

answer
817

Views

pyzmq - undefined symbol: zmq_msg_gets [duplicate]

This question already has an answer here: pyzmq installation error 3 answers I have problem with zeromq, I get this error: Traceback (most recent call last): File 'BasicPub.py', line 1, in import zmq File '/home/przemek/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/zmq/__init__.py',...
pb.
2

votes
1

answer
43

Views

MQL5 Zmq PUB socket not being received by Python zmq SUB socket

I'm trying to set up a PUB socket in MQL5 and a SUB socket in Python that will receive messages. I have this in MQL5: #include Context context('helloworld'); Socket socket(context,ZMQ_PUB); string BROKER; int OnInit() { if (socket.bind('tcp://*:5556')) { Print('Error'); } else Print('Bound'); BROKE...
IVlad
3

votes
2

answer
1.1k

Views

How to setup a ZMQ PUB/SUB pattern to serve only for pre-authorized subscriber(s)

How can I implement or do kind of 'hack' in PUB-SUB pattern to get an ability to publish only to authorized subscribers, disconnect unauthorized subscribers etc? I googled for this problem, but all the answers very similar to set subscribe filter in subscriber side. But I want, as I said, publish my...
user2123079
4

votes
1

answer
1.1k

Views

pyzmq recv_json can't decode message sent by send_json

Here is my code with the extraneous stuff stripped out: coordinator.py context = zmq.Context() socket = context.socket(zmq.ROUTER) port = socket.bind_to_random_port(ZMQ_ADDRESS) poller = zmq.Poller() poller.register(socket, zmq.POLLIN) while True: event = poller.poll(1) if not event: continue proces...
Anentropic
2

votes
1

answer
519

Views

could not install pyzmq using apt,pip,pip3,easy_install etc any command

I tried everything pyzmq package is not installing I even tried to read all related issues on GitHub , quora and stack-overflow but nothing works it stops while trying wheel i even reinstall wheel but no result plz help me !!!! I have already install all basic prereq stuff I even install clang an...
farman chauhan
19

votes
4

answer
11.2k

Views

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
5

votes
4

answer
6k

Views

py2exe: error: libzmq.pyd: No such file or directory

During py2exe build I get the following error: creating python loader for extension 'win32clipboard' (C:\Python27\lib\site-packages\win32\win32clipboard.pyd -> win32clipboard.pyd) creating python loader for extension '_rl_accel' (C:\Python27\lib\site-packages\_rl_accel.pyd -> _rl_accel.pyd) *** find...
Mads M Pedersen
6

votes
2

answer
5.9k

Views

ZeroMQ, how to connect to external tcp socket?

Can you please tell me how you can use to send messages ZeroMQ between two programs located on different servers using some common socket? With all local sockets program works, but I do not understand how they spread to different places. Because climbs error: Traceback (most recent call last): File...
Ellochka Cannibal
6

votes
1

answer
2.8k

Views

ZeroMQ PubSub not working w\ Pyzmq

There is probably something very small that I am missing but I am unable to get a simple pub-sub example working in Python using the official Pyzmq package (https://github.com/zeromq/pyzmq). I am using the latest ZeroMQ stable release 4.0.3 and am able to get a simple example working pretty easily i...
Stephen
6

votes
1

answer
2.2k

Views

ZeroMQ: have to sleep before send

I'm write a zeromq demo with Forwarder device (with pyzmq) Here are the codes(reference to https://learning-0mq-with-pyzmq.readthedocs.org/en/latest/pyzmq/devices/forwarder.html ): forwarder.py import zmq context = zmq.Context() frontend = context.socket(zmq.SUB) frontend.bind('tcp://*:5559') fronte...
wong2
5

votes
1

answer
2.8k

Views

Why does zmq.setsockopt_string complain about default 'ascii' code?

I'm trying to figure out if my dev environment is somehow screwed up, since 'it works on [my colleagues] computer' but not mine. Instead of tackling the 'meat' of the problem, I'm working on the first funny thing I've spotted. I have a bit of code that doesn't make sense why one call would work, an...
Bitdiot
2

votes
1

answer
134

Views

Pub Sub only works in one direction

So I am using the python bindings for ZeroMQ in an attempt to send messages to several raspberry pis on a network for an art project. The issue is that I am not receiving any messages on the raspberry pi. To make matters worse, I can: Publish messages from the raspberry pi and receive them on my lap...
Random Name
4

votes
1

answer
1.1k

Views

Interrupting Flask app in iPythonNotebook cause ZMQerror

I'm trying to run a most simple demo of flask app in an iPython notebook like this. from flask import Flask app = Flask(__name__) @app.route('/') def hello_world():. return 'Hello World!' if __name__ == '__main__': app.run(d) The first time I run it, all is fine. Then I interrupted the cell with app...
zaxliu
4

votes
1

answer
241

Views

Why are LINGER=0 and SNDTIMEO=0 used for Zyre actors' PAIR sockets?

Reviewing Pyre's (Python version of Zyre) source code, I saw the following: def zcreate_pipe(ctx, hwm=1000): backend = zsocket.ZSocket(ctx, zmq.PAIR) frontend = zsocket.ZSocket(ctx, zmq.PAIR) # ... # close immediately on shutdown backend.setsockopt(zmq.LINGER, 0) frontend.setsockopt(zmq.LINGER, 0) c...
Silly Freak
2

votes
1

answer
1.4k

Views

Pulling requests from multiple clients with ZMQ

I have a couple of workers waiting to do some jobs. I see that in the PULL/PUSH pattern I need to give the workers the ip address (using the tcp protocol) of the client, so it can listen to requests from there. However, in my case I want to have a lot of clients as well, coming from different IPs wi...
Joel
2

votes
1

answer
498

Views

Nuitka with zeroMQ

I am trying to use Nuitka to compile a simple zeroMQ example and am having problems. I have used the following command to compile: nuitka --standalone --portable --remove-output --recurse-all --python-version=3.4 testclient.py and I get the following compile time warning: Nuitka:WARNING:testclient....
Ron
2

votes
1

answer
178

Views

Why I can't import pyzmq on ubuntu 14.04 LTS?

I have installed zmq and pyzmq.But I can't import pyzmq. >>> Successfully installed pyzmq Cleaning up... [email protected]:~$ python enter code here Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type 'help', 'copyright', 'credits' or 'license' for more information. >>> import pyzmq Tr...
Peng He
2

votes
1

answer
987

Views

ZeroMQ poll thread safety

I have a thread that is polling on a ZMQ Poller: poller.poll(timeout) This thread is also the one which receives and sends back messages over the sockets registered in the poller. Then I have another thread that may, eventually, create a new socket and register it for polling on input events: socket...
Peque
2

votes
1

answer
659

Views

Same ZMQ_IDENTITY for multiple Subcribers

I am building a zeromq PUB-SUB pattern with lots of subscribers to one publisher. I want to build durable Subscribers, so I found out about the ZMQ_IDENTITy socket-option. What should I take into account when choosing the value for the Identity? And can I take the same for all subscribers? Since th...
dhpizza
1

votes
2

answer
1.7k

Views

send a number by zeromq pyzmq

I want to send lots of numbers via zeromq but converting them to str is inefficient. What is the best way to send numbers via zmq?
Davoud Taghawi-Nejad
4

votes
1

answer
1.7k

Views

Sniffer/monitor in client/server config with ZMQ in Python

I implemented a client/server via ZeroMQ and I would like to add a sniffer/monitor to capture the communication between the two. client server (REQ) | (REP) | | v sniffer
flamenco
2

votes
2

answer
336

Views

How to install pyzmq on a Alpine Linux container?

I have a container with python:3.6-alpine kernel, I have a problem to install the pyzmq with pip on this: Dockerfile: FROM python:3.6-alpine RUN mkdir /code RUN apk add vim WORKDIR / ADD . /code docker-compose.yml: version: '3' services: battery_monitoring: build: . image: bm:1.0.0 container_name: b...
Benyamin Jafari
2

votes
0

answer
998

Views

Freezing app with Esky and zmq modules

I'm trying to freeze my app using Esky and cx_freeze. My setup.py looks something like this: from esky.bdist_esky import Executable from distutils.core import setup includes = ['zmq'] exe = Executable('main.py') setup( name = 'Jarvis', version = '0.1', options = {'bdist_esky' : {'includes' : includ...
pompa
3

votes
2

answer
1.9k

Views

Identifying the origin of ZMQ messages?

If I receive a message via the recv() method on a ZeroMQ (0MQ) socket... data = s.recv() ...is there any way for me to get at the value of getpeername() for the underlying socket? My goal is to identify the origin of the message in a way that does not rely on the sender to provide accurate informat...
larsks
2

votes
1

answer
192

Views

ZMQ in Python - Can the PULL-side process know if the PUSH-side process was closed?

I use ZMQ in python to distribute calculations between a master application and worker sub-processes, via a PUSH-PULL. At times, the master might crash and the sub-processes remain hanging, listening to their respective ports. I tried to use atexit to close the workers in the event that the master c...
Pythonic
2

votes
3

answer
1.5k

Views

ZeroMQ inter process communication from single thread loses messages

I am currently exploring possibilities to test my zeromq applications. I was under the impression that I could just have a publisher/subscriber in the same thread, let the publisher publish and the subscriber subscribe to it without losing messages. Yet, when I let the publisher send a couple of mes...
bayer
2

votes
1

answer
216

Views

Why does my recv hang for large messages when the sender closes the socket?

When I send a data from a socket and then immediately close it (without changing the default settings), small data sizes are sent successfully but large ones (> 2MB) are not. Here is how I set up the receiver (blocking on the recv() at the end): In [1]: import zmq In [2]: ctx = zmq.Context() In [3]:...
capitalistcuttle

View additional questions