zmq

ZeroMQ XPUB/XSUB Serious Flaw?

匿名 (未验证) 提交于 2019-12-03 08:56:10
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: It seems as though the XPUB/XSUB socket types have a serious flaw that is difficult to work around: This is my implementation of that center node: #include <zmq.hpp> int main() { zmq::context_t context(1); //Incoming publications come here zmq::socket_t sub(context, ZMQ_XSUB); sub.bind("ipc://subscriber.ipc"); //Outgoing publications go out through here. zmq::socket_t pub(context, ZMQ_XPUB); pub.bind("ipc://publisher.ipc"); zmq::proxy(sub, pub, nullptr); return 0; } The problem is, of course, slow joiner syndrome. If I connect a new

Cannot import zmq in python (install issue)

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I can't seem to install pyzmq on my macbook (OSX 10.9.1) First call was to run: sudo pip install pyzmq There was an error that libzmq couldn't be found, and it appeared to try and compile the bundled version: jono@air:~ $ sudo pip install pyzmq Password: Downloading/unpacking pyzmq Downloading pyzmq-14.0.1.tar.gz (867kB): 867kB downloaded Running setup.py egg_info for package pyzmq no previously-included directories found matching 'docs/build' no previously-included directories found matching 'docs/gh-pages' warning: no directories found

How to import zeromq libraries in cmake?

匿名 (未验证) 提交于 2019-12-03 03:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm just starting to learn how to work with zeromq libraries and using them in different C++ projects. The sample code that I wrote (actually copied from there tutorials)is this: // file: main.cpp // Hello World client in C++ // Connects REQ socket to tcp://localhost:5555 // Sends "Hello" to server, expects "World" back // #include <zmq.hpp> #include <string> #include <iostream> int main () { // Prepare our context and socket zmq::context_t context (1); zmq::socket_t socket (context, ZMQ_REQ); std::cout << "Connecting to hello world server…"

Troubles with zmq_bind() in ZeroMQ binding for MQL4 language

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am working on MT4 and used wrapper mql4zmq.dll as given in link https://github.com/AustenConrad/mql4zmq As I have followed all instruction and successfully loaded DLL as well as lib file at specific locations from pre-compiled. But it can not bind or connect with socket through zmq_connect(,) or zmq_bind(,) . Please some one help me to solve this problem. I am posting my code here // Include the libzmq.dll abstraction wrapper. #include <mql4zmq.mqh> //+------------------------------------------------------------------+ //| variable

Why is the ZMQ_RCVHWM option of ZeroMQ ineffective?

匿名 (未验证) 提交于 2019-12-03 01:46:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: There is an endpoint, which is Dealer, and an endpoint which is Router. The Dealer is connected to the Router by TCP protocol. I set ZMQ_SNDHWM and ZMQ_RCVHWM to 1 for all of them. Note that the Dealer always sends to Router, but the Router does not receive. The questions are: When the Router is not set up, the Dealer just sends one message and is then obstructed. That is right, because ZMQ_SNDHWM is 1. But when I setup the Router, the Dealer can continue send about 4K msg and obstructed. Why? Another, if I let Router receive just

ZMQ socket connect timeout

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to connect a socket to an endpoint until the socket receives data from that endpoint. This is because the endpoint might not exist at that time. Currently the connect stalls, i'm guessing because it can't resolve the hostname and that takes a while. Is there any way to set a timeout on a socket connect? import zmq import time endpoint = 'tcp://doesnt_exist:12345' ctx = zmq.Context.instance() s = ctx.socket(zmq.SUB) t = time.time() try: s.connect(endpoint) except Exception: pass print time.time() - t 回答1: If you provide a host name

ZeroMQ&#039;s EPGM not working in weather PUB-SUB demo

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have compiled libzmq with openpgm with no changes under windows. Code here is taken from ZeroMQ Guide ("weather publisher" server/client). But if i change "tcp" to "epgm" it doesn't work any more (data is not received, but connection is established). void test_serv() { // Prepare our context and publisher void *context = zmq_ctx_new(); void *publisher = zmq_socket(context, ZMQ_PUB); int rc = zmq_bind(publisher, "epgm://127.0.0.1:5556"); assert(rc == 0); // Initialize random number generator srandom((unsigned)time(NULL)); while (!stop

ZeroMQ: Address in use error when re-binding socket

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: After binding a ZeroMQ socket to an endpoint and closing the socket, binding another socket to the same endpoint requires several attempts. The previous calls to zmq_bind up until the successful one fail with the error "Address in use" ( EADDRINUSE ). The following code demonstrates the problem: #include <cassert> #include <iostream> #include "zmq.h" int main() { void *ctx = zmq_ctx_new(); assert( ctx ); void *skt; skt = zmq_socket( ctx, ZMQ_REP ); assert( skt ); assert( zmq_bind( skt, "tcp://*:5555" ) == 0 ); assert( zmq_close( skt ) == 0 )

ZeroMQ with msgpack, in C++, throws an invalid argument error [closed]

匿名 (未验证) 提交于 2019-12-03 00:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using zeromq to read data from an application which uses msgpack for serializing. The code compiles well but throws an invalid argument error when run. Where am I being wrong. Here is the error: terminate called after throwing an instance of 'zmq::error_t' what(): Invalid argument Abort (core dumped) Here's the code. #include <zmq.hpp> #include <iostream> #include <sstream> #include <msgpack.hpp> #include <string> int main(int argc, char *argv[]){ zmq::context_t context (1); // Open a req port to talk to application std::string addr =

ZMQ面面观

匿名 (未验证) 提交于 2019-12-02 23:48:02
在ZeroMQ中并没有绝对的服务端与客户端之分,所有的数据接收与发送都是以连接为单位的,只区分ZeroMQ定义的类型,例如Response与Request,Publisher与Subscriber,Push与Pull等。。。 https://blog.csdn.net/fjslovejhl/article/details/16862817 函数zmq_socket()根据context参数创建一个ZMQ套接字(socket),并且以一个不透明指针的形式返回这新创建的socket。type参数指明了要创建的socket的类型,这个类型决定了在进行传输时在此socket上执行的语义。 新创建的socket初始值是未绑定的,并且未和任何终结点相联系。为了能够在一个socket上建立消息,必须先要使用zmq_connect(3)连接上一个终结点,或者至少有使用zmq_bind(3)函数绑定一个终结点来接收传入的消息。 https://www.cnblogs.com/fengbohello/p/4354989.html 这种模式与pub/sub模式一样都是单向的,区别有两点: 1,该模式下在没有消费者的情况下,发布者的信息是不会消耗的(由发布者进程维护) 2,多个消费者消费的是同一列信息,假设A得到了一条信息,则B将不再得到 这种模式主要针对在消费者能力不够的情况下