zeromq

To discover other device IP:Port in same wifi network using ZeroMQ

限于喜欢 提交于 2020-01-06 07:34:11
问题 I want to discover all Android devices IP and Port in same wifi network using ZeroMQ? My app basically connect all device in same wifi network (no internet needed) and message to each other. Once ip and port I know I am send message successfully but how to know all device internet Protocol (ip) Using ZeroMQ? 回答1: Principle Part A) Every IEEE 802.x CSMA/CD network "collision domain" ( wifi AP/SSID is such one ) has to be managed so as to work well. Thus the Address Resolution Protocol [ARP]

Using ZeroMQ in VS2012 C++

对着背影说爱祢 提交于 2020-01-05 07:48:06
问题 So i installed the ZeroMQ in python(and it's working) but i can't do it in Visual studio 2012 C++. I downloaded the windows installer, installed it and searched in the installation folder which is: -an "include" folder with 2 header files which i copied into my VS include -a "lib" folder with 3 lib files and 3 pdb files which i copied into my VS lib -a "bin" folder which i copied into my VS bin After this, i tried to use zmq::context_t... and zmq::socket_t... but i couldn't do it, it said

Router Hanging in Dealer-Router Setup

半城伤御伤魂 提交于 2020-01-05 04:43:31
问题 Given the following attempt to connect 1 DEALER to 1 ROUTER : package net.async import org.zeromq.ZMQ import org.zeromq.ZMQ.Socket import scala.annotation.tailrec object Client { val Empty = "".getBytes def message(x: Int) = s"HELLO_#$x".getBytes val Count = 5 } class Client(name: String) extends Runnable { import Client._ import AsyncClientServer.Port override def run(): Unit = { val context = ZMQ.context(1) val dealer = context.socket(ZMQ.DEALER) dealer.setIdentity(name.getBytes) dealer

Zeromq with python hangs if connecting to invalid socket

放肆的年华 提交于 2020-01-04 05:14:11
问题 If I connect to an inexistent socket with pyzmq I need to hit CTRL_C to stop the program. Could someone explay why this happens? import zmq INVALID_ADDR = 'ipc:///tmp/idontexist.socket' context = zmq.Context() socket = context.socket(zmq.REQ) socket.connect(INVALID_ADDR) socket.send('hello') poller = zmq.Poller() poller.register(socket, zmq.POLLIN) conn = dict(poller.poll(1000)) if conn: if conn.get(socket) == zmq.POLLIN: print "got result: ", socket.recv(zmq.NOBLOCK) else: print 'got no

RPC Framework in C++ utilizing ZeroMQ

那年仲夏 提交于 2020-01-03 19:01:30
问题 I need to write a client-server application in C++ using ZeroMQ push-pull socket pattern. The client has to make RPC calls to the functions specified in the server interface. I wonder if there is an open source and commercially usable library/framework for this purpose primarily in C++. I made some googling and there seem to be things written in python but I prefer something in C++ that comes handy with ZeroMQ if possible. Any suggestion/guidance is appreciated. Thanks. 回答1: Google protobuf

ZeroMQ doesn't auto-reconnect

僤鯓⒐⒋嵵緔 提交于 2020-01-03 13:35:19
问题 I've just downloaded and installed zeromq-4.0.5 on an Unbutu Precise (12.04) system. I've compiled the hello-world client ( REQ , connect, 127.0.0.1) and server ( REP , bind) written in C. I start the server. I start the client. Each second the client sends a message to the server, and receives a response. I press Ctrl- C to stop the server. The client tries to send its next outgoing message and it gets stuck in an never-returning epoll system call (as shown by strace ). I restart the server.

zeromq zmq.Poller & stdin

不羁岁月 提交于 2020-01-03 13:14:09
问题 Is it possible to use zmq.Poller to also poll for data availability on stdin ? If not, what would be the most efficient wait to poll, at the some time (ideally), for data availability on zeromq sockets & stdin ? 回答1: yes, zmq pollers do support native FDs, including stdin, etc., so you just need to check sys.stdin.fileno() : poller = zmq.Poller() poller.register(sys.stdin, zmq.POLLIN) poller.register(mysocket, zmq.POLLIN) evts = dict(poller.poll(1000)) stdin_ready = evts.get(sys.stdin.fileno(

zeromq源码分析笔记之无锁队列ypipe_t(3)

女生的网名这么多〃 提交于 2020-01-03 02:41:04
在上一篇中说到了mailbox_t的底层实际上使用了管道ypipe_t来存储命令。而ypipe_t实质上是一个无锁队列,其底层使用了yqueue_t队列,ypipe_t是对yueue_t的再包装,所以我们先来看看yqueue_t是怎么实现的。 1、yqueue_t yqueue_t是一个高效的队列,高效体现在她的内存配置上,尽量少的申请内存,尽量重用将要释放的内存。其实,容器的设计都会涉及这点--高效的内存配置器,像sgi stl容器的内存配置器,使用了内存池,预先分配一块较大内存,用不同大小的桶管理,容器申请内存时从相应的桶里拿一块内存,释放内存时又把内存回收到相应的桶里,这样就能做到尽量少的malloc调用。yqueue_t并没有使用内存池,但是利用了同样的思想,一次性分配一个chunk_t减少内存分配次数,并用spare_chunk管理将要释放的块用于内存回收,详细的实现后面再说,先看一下yqueue_t的整个概况,源码位于Yqueue.hpp // T is the type of the object in the queue.队列中元素的类型 // N is granularity(粒度) of the queue,简单来说就是yqueue_t一个结点可以装载N个T类型的元素,可以猜想yqueue_t的一个结点应该是个数组 template <typename T,

zeromq源码分析笔记之线程间收发命令(2)

时光毁灭记忆、已成空白 提交于 2020-01-03 02:40:56
在 zeromq源码分析笔记之架构 说到了zmq的整体架构,可以看到线程间通信包括两类,一类是用于收发命令,告知对象该调用什么方法去做什么事情,命令的结构由 command_t结构体确定 ;另一类是socket_base_t实例与session的消息通信,消息的结构由 msg_t确定。命令的发送与存储是通过mailbox_t实现的,消息的发送和存储是通过pipe_t实现的,这两个结构都会详细说到,今天先说一下线程间的收发命令。 zeromq的线程可分为两类,一类是io线程,像reaper_t、io_thread_t都属于这一类,这类线程的特点就是内含一个轮询器poller及mailbox_t, 通过 poller 可以 监听激活 mailbox_t的 信号 ;另一类是zmq的socket,所有socket_base_t实例化的对象都可以看做一个单独的线程,这类线程不含poller,但同样含有一个mailbox_t,可以用于收发命令,由于不含poller,只能在每次使用socket_base_t实例的时候先处理一下mailbox_t,看是否有命令需要处理,代码上来看就是每次先调用下面这个函数接收并处理一下命令: int zmq::socket_base_t::process_commands (int timeout_, bool throttle_) 另外

App crashes on iOS 6: Symbol not found: ___sync_fetch_and_add_4

一曲冷凌霜 提交于 2020-01-02 15:53:07
问题 I have an application that works perfectly with iOS4 and iOS5. It uses a statically compiled version of the zeromq library, targeted for ARM. Apple denied my application because they claim it crashes under iOS 6 (yet unreleased..wth?) After trying it with the iOS 6 GM I can confirm it does crash when we initialize the ZeroMQ socket. Here is the crash messages: dyld: lazy symbol binding failed: Symbol not found: ___sync_fetch_and_add_4 Referenced from: /var/mobile/Applications/00EDEEDA-0068