[nanomsg] Re: .NET wrapper for nanomsg

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: Matt Howlett <matt.howlett@xxxxxxxxx>
  • Date: Thu, 12 Sep 2013 15:53:22 +0200

On 12/09/13 15:11, Matt Howlett wrote:

The C# nanomsg wrapper is coming along nicely.

The next thing I want (need) is to include poll/select type functionality.

I see I should be able to use nn_getsockopt to get enough information
to implement this, and I assume this is what you intend, however I
think I'm going to have to start pinvoking the winsock / equivalent
linux libraries and writing some non-trivial code for both platforms,
which is more annoying than I was hoping (and I'm not an expert so
it'll take me a bit of time to implement and I might screw something
up).

I see you have some poll related functionality in the library under
src/aio (which I haven't looked at in detail), however this is not
accessible (exported) ? Right now I don't see the purpose (apologies
if that is obvious).

Do you intend to expose some sort of polling functionality? My feeling
is you should, though it's very possible I don't know enough about
what I'm talking about to have a valid opinion.

The real problem here is how to integrate nanomsg sockets with other kinds of sockets (TCP, UDP, whatever) in a single poll loop.

On C level it's relatively easy. nanomsg provides file descriptors to poll on and that's it.

On language binding level it gets a bit more messy. Presumably, the language already has an mechanism to poll on sockets. The question is: Is it possible to extend this mechanism to use new types of sockets (nanomsg sockets in our case). If so, we are done. If not, we are in a trouble.

Further, Windows' botched implementation of BSD socket API presents another problem. Yes, they have sockets and even the select() call, but it only works for TCP and UDP. If you want to integrate with something else (like NamedPipes) you have to use Windows-specific IOCP API. To be frank, it's not even obvious how .NET can be ported to UNIX platforms (mono) and still remain platform independent -- both platforms have conceptually incompatible polling mechanisms after all.

Btw, I'm cc'ing the nanomsg mailing list in case other binding maintainers have anything to say about the topic.

Martin


Other related posts: