[zeromq-dev] Question for Python example in Perf folder

kfadnis kfadnis at gmail.com
Wed Apr 22 17:09:04 CEST 2009


Thanks Martin.
Yes, the example you have provided works. But I was trying a message size
other than 1, and it didn't work for me.
Also, I tried to wrap the functionality of py_remote_thr in a class. The
method "bind('EL','GQ')' method gives an assertion error  in locator.cpp
 line 93
cmd == get_ok_id

here is my python class. Everything is exactly the same as py_remote_thr.py
except its wrapped in a class

import sys
import libpyzmq
class remoteSend:
    def __init__(self,hostname,message_count,message_size):
        self.z = libpyzmq.Zmq(host = hostname)
        self.message_size = message_size
        self.message_count = message_count
        self.eid =
self.z.create_exchange(name='EL',scope=libpyzmq.SCOPE_LOCAL,style=libpyzmq.STYLE_LOAD_BALANCING)
        self.z.bind('EL','GQ')
        self.msg = ''.join(['a' for n in range(0,self.message_size)])
    def sendmsg(self):
      self.z.send(self.eid,self.msg,True)

x = remoteSend("localhost",10,100)
for i in range(0,x.message_count):
    x.sendmsg()



On Wed, Apr 22, 2009 at 3:08 AM, Martin Sustrik <sustrik at fastmq.com> wrote:

> Hi,
>
> Ok, I got it working. For some reason, maybe someone can explain,
>> "localhost:portnumber" did not work, but "*:portnumber" worked. So i tried
>> "*:1234" and it worked.
>>
>
> The problem here is that while the first argument is the name of the *box*
> zmq_server is running on, the second argument is name of the *network
> interface* that the global service is exposed on.
>
> Aamir's system is presumably configured so that it resolves "localhost" to
> IP address 127.0.0.1 (on Linux, more correct way to specify the loopback
> interface would be "lo" though).
>
> As you are running Windows you have to enter IP address of the network
> interface card you want to use for your global service manually. The problem
> is that while *nix systems network interfaces have reasonable names (like
> "lo", "eth0" etc.) on Win32 the names are "Intel(R) 82566DM-2 Gigabit
> Network" and similar. Thus entering numeric value makes more sense.
>
> In short, to create a global service use say "127.0.0.1:1234" to host it
> on loopback interface or say "192.168.0.115:1234" (or whatever the address
> of your NIC is) to host it on actual network interface card.
>
> But  another problem came up, the message size transmitted is incorrect and
>> thus the assertion for checking the message size on the local side fails. I
>> tried sending various messages and the messsages themselves come through
>> fine, but the size does not match.
>>
>
> Are you sure you haven't mixed message size and message count parameters?
>
> I've tried following on WinXP:
>
> zmq_server.exe
>
> python py_local_thr.py localhost 127.0.0.1:5555 1 100
>
> python py_remote_thr.py localhost 1 100
>
> And everything seems to work fine. If you are still experiencing problem
> can you let us know exact command lines you are using?
>
> Martin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090422/1cf22489/attachment.html>


More information about the zeromq-dev mailing list