[nanomsg] Re: Loadbalancer with async backend

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Fri, 22 Nov 2013 11:39:46 +0100

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 22/11/13 11:20, Stefan de Konink wrote:

> Is there already something like a best practise for nnpy to emulate
> the 'poller' behavior found in ZeroMQ? I don't mind to write in C
> using the getevents example in poll.c, but it would be nice if
> there was already some example of doing that in Python.

Well, this is something that haven't been decided yet.

Basically, the idea was to provide OS level file descriptors for
polling (NN_SNDFD and NN_RCVFD) and let each language binding handle
the polling in language-specific way.

However, it seems that some languages (Java?) have no generic way to
do polling, they can only handle specific protocols, such as TCP or UDP.

That being the case, the only to deal with polling seems to be
implementing nn_poll() function (an equivalent of zmq_poll()) and let
the language bindings that have no concept of polling on file
descriptors wrap that function.

I am not sure whether Python is a language with no concept of polling
on file descriptors. If it isn't, just use NN_SNDFD and NN_RCVFD. If
it is, I can implement the nn_poll() function (it's rather trivial),
but you'll still have to wrap it in python binding, or, alternatively,
ask the maintainers to wrap it.

Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSjzRyAAoJENTpVjxCNN9YPCsH/2P0eYz9OE7buDI65YKU9/ZL
qtE/On2IHHIuvYCH3VbzXZm3Gi62t12mZIdTi8LxUwJ145Bjkx/CucTIO2SbuRNy
6rq42/vAakIAjksCuXR4pK2by6NYP5/rXxksG3kP669ltEBG6F6PR/H4bKDSyMek
W7qyYlS0ClquPCyzOGW63mBou2enHb4kr3ybgq8SEHDQjT4qG4EmDU2Tf4+q2W/y
3hfSMuQEUst3W2De2aTfeJaVP3RlQR2Z7RA38EoBoLGspa6Zr0fm/2P/UIRrUZaY
vyIsM8TsL0PclaiVLERB/CGZtPUpFZMFZf7ySmO+bpk6Xj0cYCetRtEFXUqzwo8=
=hpUb
-----END PGP SIGNATURE-----

Other related posts: