Reputation: 2614
I've been trying to get zeromq working with Python on Fedora 11. As it needed Python 2.7, I installed ActivePython. I installed pyzmq using easy_install and it installed fine. When I run the hello world example from here:
http://zguide.zeromq.org/py:hwclient
It blocks on:
socket.recv()
I have read that there are issues where you can send messages faster than the client can receive them and this can cause the client to miss the "first" message. So, what I'm not sure about is whether or not this is expected behaviour or at least possible behaviour. I would have thought that a simple Hello World example would have worked out of the box...
What I'm trying to figure out is whether or not it is the code or my installation that's causing the problem.
Anyone come across something similar?
Upvotes: 1
Views: 693
Reputation: 32392
To be honest, I skipped over the hello-world bit and went straight to the Lazy Pirate pattern client-server. That one did have some bugs in the Python version in the client retry loops, but at least it did something. I added a few print statements and got a proper client-server communication going.
After that I wrote a memcache kind of server using JSON objects for my message bodies. E.g. {"CMD": "GET", "KEY": "Albert Jones" }
A couple of months later, I needed a persistent key-value server at work for a multiprocessing system, so I turned my existing code into an SQLITE key-value server. By "key-value" I mean that the entire schema of the server was one table KVSTORE with two columns, KEY and VAL. I now have that server being accessed by up to 40 client processes at a time, with no hitches.
I have also tried my hand at writing a server that uses the actual memcache protocol using asynchat, and it is far more complex than using ZeroMQ.
So my advice is to move on. If the hello world example does not work, try a different one.
P.S. If you want a portable Python distro that runs on Fedora or any other distro, have a look at https://github.com/wavetossed/pybuild Currently you have to build it on an Ubuntu system, but the resulting tarball includes all shared library dependencies and runs on Redhat/RPM style distros and SUSE/RPM style distros. It has plenty of examples of building 3rd party libraries so you should have few problems in adding your favourite modules to your own Python distro.
Upvotes: 2