[zeromq-dev] C++ - Poll multiple sockets in different classes

Piero Cornice piero.cornice at provision-comm.com
Wed Oct 6 11:10:03 CEST 2010


  Hi everyone,

I'm writing a TCP server to which I can "plug" multiple TCP sockets at 
runtime.

The structure is pretty simple. There's a "MultiServer" class (the 
actual server) and a "TCPListener" class, which contains a TCP socket. 
The Server creates a ZMQ context, passes it to a Listener [setup()] and 
then polls all listeners' [receive()].

The problem is that I'm getting a segmentation fault on the poll(), see 
below for GDB output.
Here's a snippet demonstrating my problem: http://pastebin.com/tckkL1FW.

Any hint will be much appreciated, thank you.

--- GDB output ---

[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff7d8a710 (LWP 20509)]
[TCP] Binding to tcp://*:25000
[+] Added TCPListener ffffdd30 (socket: 6063a0)
[ ] Polling 1 listener(s)...
[0] { 6063a0 | 0 | 1 | 0 }

Program received signal SIGSEGV, Segmentation fault.
zmq::signaler_t::get_fd (this=0x30) at signaler.cpp:38
38    {
(gdb) bt
#0  zmq::signaler_t::get_fd (this=0x30) at signaler.cpp:38
#1  0x00007ffff7dc0935 in zmq_poll (items_=0x7fffffffdc60,
     nitems_=<value optimized out>, timeout_=-1) at zmq.cpp:421
#2  0x00000000004022eb in zmq::poll(zmq_pollitem_t*, int, long) ()
#3  0x0000000000401eeb in MultiServer::receive(long) ()
#4  0x0000000000402034 in main ()



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20101006/e11d7ed1/attachment.htm>


More information about the zeromq-dev mailing list