[zeromq-dev] odd error from pyzmq

Osiris Pedroso opedroso at gmail.com
Mon Feb 29 06:16:07 CET 2016


So happy I was able to help somebody with a ZeroMQ problem.
Linus was right: With enough eyeballs, all bugs are shallow

On Fri, Feb 26, 2016 at 4:34 PM Jerry Scharf <scharf at lagunawayconsulting.com>
wrote:

> Osiris,
>
> (slap forehead with palm) That explains it... thanks for the quick help.
>
>
> jerry
>
>
> On 02/26/2016 11:59 AM, Osiris Pedroso wrote:
>
> Isn't the problem that both sides are binding?
> I believe one side should bind, the other should connect.
>
> On Fri, Feb 26, 2016 at 1:15 PM Jerry Scharf <
> scharf at lagunawayconsulting.com> wrote:
>
>> Hi,
>>
>> That's not it. I added a gethostbyname to the code, that works but the
>> bind still fails. I did a simple socket connect to the host/port in python
>> and that works fine (no error, netstat shows the connection.)
>>
>> I think the code is pretty generic, I tried to keep it as simple as
>> possible to start with.
>>
>> Here's master (client) side code:
>>
>>     cmdsock = zc.socket(zmq.REQ)
>>     evsock = zc.socket(zmq.SUB)
>>
>>
>>     cmdport = 10011
>>     subport = 10012
>>
>>     hostip = socket.gethostbyname(hostname)
>>     evconn = "tcp://{}:{}".format(hostip, subport)
>>     evsock.bind(evconn)
>>     cmdconn = "tcp://{}:{}".format(hostname, cmdport)
>>     cmdsock.bind(cmdconn)
>>
>>
>> here's the listener side code
>>
>>     mzcontext = zmq.Context()
>>
>>     rrportnum = 10011
>>     psportnum = 10012
>>
>>     rrsock = mzcontext.socket(zmq.REP)
>>     rrsockstr = "tcp://*:{0}".format(rrportnum)
>>     rrsock.bind(rrsockstr)
>>
>>     pssock = mzcontext.socket(zmq.PUB)
>>     pssock.bind("tcp://*:{0}".format(psportnum))
>>
>>
>>
>> On 02/26/2016 12:16 AM, MinRK wrote:
>>
>> Typically, with bind you want an IP address. Often a domain works, but it
>> requires that zeromq can resolve that domain to a *local* IP address of
>> the machine. This won’t work, for instance, if your raspberry pi is behind
>> a router. You can listen on all IPs by using 'tcp://*:10011'.
>>
>> -MinRK
>>
>> On Fri, Feb 26, 2016 at 1:11 AM, Jerry Scharf <
>> scharf at lagunawayconsulting.com> wrote:
>>
>>> Hi,
>>>
>>> I'm working further into things. I have the raspberry pi side working
>>> happily and am now trying to get the ubuntu master side working. I am
>>> running python 3.4 and did the install from pip with no errors. (I am
>>> running python2.7 on the pi side to get spi routines...)
>>>
>>> The socket create works fine, but wen I try to bind to my host as a
>>> fully qualified hostname:port (in this case
>>> "bank0pi.lt.in.finsix.com:10011" I get this stackdump:
>>>
>>> File "/home/jerry/finsix/marathon/master/simple/m_zmq.py", line 29, in
>>> bank_setup
>>>     evsock.bind(evconn)
>>>    File "zmq/backend/cython/socket.pyx", line 487, in
>>> zmq.backend.cython.socket.Socket.bind (zmq/backend/cython/socket.c:5156)
>>>     File "zmq/backend/cython/checkrc.pxd", line 25, in
>>> zmq.backend.cython.checkrc._check_rc (zmq/backend/cython/socket.c:7535)
>>> zmq.error.ZMQError: No such device
>>>
>>> What device is it looking for?? I check with host and the name resolves
>>> fine.
>>>
>>> tia,
>>> jerry
>>>
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>
>>>>
>>
>> _______________________________________________
>> zeromq-dev mailing listzeromq-dev at lists.zeromq.orghttp://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>
>
> _______________________________________________
> zeromq-dev mailing listzeromq-dev at lists.zeromq.orghttp://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160229/299e6d3e/attachment.htm>


More information about the zeromq-dev mailing list