[nanomsg] Re: Polling

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Tue, 02 Jul 2013 08:53:59 +0200

Hi Gonzalo,

/"Polling mechanism, given that it is a glue between disparate types of
subsystems (file systems, networking stack, etc.) must be defined by the
platform rather than by any individual subsystem (such as nanomsg).
Thus, binding developer should try to integrate nanomsg into the native
polling mechanism. File descriptors retrieved from the socket using
NN_SNDFD and NN_RCVFD socket options can be used for this purpose. If
the language doesn't provide a native polling mechanism or if it doesn't
provide a way to plug arbitrary file descriptors into the native polling
mechanism, then the binding should do the second best thing and
implement a polling function/object itself."
/

It seems Java would fall under the category of not providing a sensible
way to integrate these nanomsg-provided file descriptors into a native
polling mechanism; at least I have not found a clean way to do that. I
would like to ask three questions on this list:

It's possible that Java, actually doesn't have a generic mechanism to handle networking, similar to BSD sockets. If so, and the only protocols that can be used from Java are TCP and UDP, it's pretty sad state of affairs.

Anyway, after some googling I've found few Java libraries that make other protocols available:

SCTP: http://openjdk.java.net/projects/sctp/javadoc/index.html
DCCP: http://code.google.com/p/jdccp/
ICMP: http://www.veraxsystems.com/en/products/icmplib

It would be worth checking how these libraries handle polling. If they don't it looks like we are on our own. If so, I'll add nn_poll() function to nanomsg. It's not much work, although, architecturally, the function doesn't belong there.

Martin

Other related posts: