zeromq

How to create ZeroMQ socket suitable both for sending and consuming?

浪尽此生 提交于 2021-01-01 09:21:28
问题 Could you please advice an ZeroMQ socket(s) architecture for the following scenario: 1) there is server listening on port 2) there are several clients connecting server simultaneously 3) server accept all connections from clients and provide bi-directional queue for each client, means both party (client N or server) can send or consume messages, i.e. both party can be INITIATOR of the communication and other party should have a callback to process the message. Should we create additional

How to create ZeroMQ socket suitable both for sending and consuming?

℡╲_俬逩灬. 提交于 2021-01-01 09:21:11
问题 Could you please advice an ZeroMQ socket(s) architecture for the following scenario: 1) there is server listening on port 2) there are several clients connecting server simultaneously 3) server accept all connections from clients and provide bi-directional queue for each client, means both party (client N or server) can send or consume messages, i.e. both party can be INITIATOR of the communication and other party should have a callback to process the message. Should we create additional

zeromq总结

爷,独闯天下 提交于 2020-12-30 17:57:07
概述 我们真正需要的是这样一种消息软件,它能够做大型消息软件所能做的一切,但使用起来又非常简单,成本很低,可以用到所有的应用程序中,没有任何依赖条件。因为没有了额外的模块,就降低了出错的概率。这种软件需要能够在所有的操作系统上运行,并能支持所有的编程语言。 ZMQ就是这样一种软件:它高效,提供了嵌入式的类库,使应用程序能够很好地在网络中扩展,成本低廉。 ZMQ的主要特点有: ZMQ会在后台线程异步地处理I/O操作,它使用一种不会死锁的数据结构来存储消息。 网络组件可以来去自如,ZMQ会负责自动重连,这就意味着你可以以任何顺序启动组件;用它创建的面向服务架构(SOA)中,服务端可以随意地加入或退出网络。 ZMQ会在有必要的情况下自动将消息放入队列中保存,一旦建立了连接就开始发送。 ZMQ有阈值(HWM)的机制,可以避免消息溢出。当队列已满,ZMQ会自动阻塞发送者,或丢弃部分消息,这些行为取决于你所使用的消息模式。 ZMQ可以让你用不同的通信协议进行连接,如TCP、广播、进程内、进程间。改变通信协议时你不需要去修改代码。 ZMQ会恰当地处理速度较慢的节点,会根据消息模式使用不同的策略。 ZMQ提供了多种模式进行消息路由,如请求-应答模式、发布-订阅模式等。这些模式可以用来搭建网络拓扑结构。 ZMQ中可以根据消息模式建立起一些中间装置(很小巧),可以用来降低网络的复杂程度。

GNU Radio OOT block : AttributeError: 'module' object has no attribute 'pthread' (using ZeroMQ sockets)

与世无争的帅哥 提交于 2020-12-15 08:38:07
问题 I've developed an Out of tree block in GNU Radio with C++. I'm using the ZMQ sockets,which are implemented with the <zmq.hpp> library, to pass data through two threads. When I try to execute my OOT block (pthread block) in GNU Radio companion, what it appears is: AttributeError: 'module' object has no attribute 'pthread'. Traceback (most recent call last): File "/home/itupac/workarea-gnuradio/Labs/pthread/top_block.py", line 161, in <module> main() File "/home/itupac/workarea-gnuradio/Labs

GNU Radio OOT block : AttributeError: 'module' object has no attribute 'pthread' (using ZeroMQ sockets)

一个人想着一个人 提交于 2020-12-15 08:38:06
问题 I've developed an Out of tree block in GNU Radio with C++. I'm using the ZMQ sockets,which are implemented with the <zmq.hpp> library, to pass data through two threads. When I try to execute my OOT block (pthread block) in GNU Radio companion, what it appears is: AttributeError: 'module' object has no attribute 'pthread'. Traceback (most recent call last): File "/home/itupac/workarea-gnuradio/Labs/pthread/top_block.py", line 161, in <module> main() File "/home/itupac/workarea-gnuradio/Labs

GNU Radio OOT block : AttributeError: 'module' object has no attribute 'pthread' (using ZeroMQ sockets)

白昼怎懂夜的黑 提交于 2020-12-15 08:35:01
问题 I've developed an Out of tree block in GNU Radio with C++. I'm using the ZMQ sockets,which are implemented with the <zmq.hpp> library, to pass data through two threads. When I try to execute my OOT block (pthread block) in GNU Radio companion, what it appears is: AttributeError: 'module' object has no attribute 'pthread'. Traceback (most recent call last): File "/home/itupac/workarea-gnuradio/Labs/pthread/top_block.py", line 161, in <module> main() File "/home/itupac/workarea-gnuradio/Labs

How configure a Multiple PUB/ single SUB python ZMQ Ubuntu

不羁的心 提交于 2020-12-15 06:27:07
问题 I have two VMs (VirtualBOx, Ubuntu 18.04 and python-zmq[16.0.2-2build2]) running within the same physical machine (Win10). Both machines are configured as Bridge and they can be ping successfully 192.168.1.66-192.168.1.55. I've followed this tutorial https://learning-0mq-with-pyzmq.readthedocs.io/en/latest/pyzmq/patterns/pubsub.html. It works if PUB (server) is configured as import zmq import random import sys import time port = "5557" if len(sys.argv) > 1: port = sys.argv[1] int(port)

How configure a Multiple PUB/ single SUB python ZMQ Ubuntu

喜夏-厌秋 提交于 2020-12-15 06:26:07
问题 I have two VMs (VirtualBOx, Ubuntu 18.04 and python-zmq[16.0.2-2build2]) running within the same physical machine (Win10). Both machines are configured as Bridge and they can be ping successfully 192.168.1.66-192.168.1.55. I've followed this tutorial https://learning-0mq-with-pyzmq.readthedocs.io/en/latest/pyzmq/patterns/pubsub.html. It works if PUB (server) is configured as import zmq import random import sys import time port = "5557" if len(sys.argv) > 1: port = sys.argv[1] int(port)

App crashes when it takes too long to reply in a ZMQ REQ/REP pattern

断了今生、忘了曾经 提交于 2020-12-15 05:49:05
问题 I am writing a plugin that interfaces with a desktop application through a ZeroMQ REQ/REP request-reply communication archetype. I can currently receive a request, but the application seemingly crashes if a reply is not sent quick enough. I receive the request on a spawned thread and put it in a queue. This queue is processed in another thread, in which the processing function is invoked by the application periodically. The message is correctly being received and processed, but the response

linux多线程下的fwrite和write使用详解

ぃ、小莉子 提交于 2020-12-11 23:59:25
Linux下的文件操作,有人喜欢用C库的文件流操作,有人喜欢用Linux的原生的系统调用。一般来说,C库的文件操作会更高效一些,因为C库自己做了文件缓存的处理。今天,主要研究多线程下的fwrite与write,每个线程都对相同的FILE*或者fd进行写操作,看看结果是否为预期行为。 第一种情况:使用C库的fwrite,其线程的实现如下: 第二种情况:使用系统调用write,其线程的实现如下: 下面看主线程的实现: 其中LOOPS定义为1000000。也就是说,线程1~3分别写入"aaaaaa\n",“bbbbbb\n”,和"cccccc\n"各一百万次。如果写入文件的操作是“线程安全”的,那么最终的文件行数应该是3百万行,且每行只可能是"aaaaaa"、“bbbbbb”、和"cccccc"的一种。 【文章福利】需要C/C++ Linux服务器架构师学习资料加群812855908(资料包括C/C++,Linux,golang技术,Nginx,ZeroMQ,MySQL,Redis,fastdfs,MongoDB,ZK,流媒体,CDN,P2P,K8S,Docker,TCP/IP,协程,DPDK,ffmpeg等) 接下来看测试结果: 1、定义了宏USE_CLIB,即使用C库的fwrite,其结果如下: 2、注释掉红USE_CLIB,即直接使用系统调用write,其结果如下: