[nanomsg] libnng : events for sendable/receivable implemented

  • From: "Garrett D'Amore" <garrett@xxxxxxxxxx>
  • To: "nanomsg@xxxxxxxxxxxxx" <nanomsg@xxxxxxxxxxxxx>
  • Date: Mon, 16 Jan 2017 23:35:14 -0800

(If you don’t care about libnng, the next generation reimplementation of
libnanomsg, toss this.)

libnng will now call into your application (using a registered callback)
when you can recv or send without blocking.  (It is not guaranteed that you
won’t block if you don’t use a non-blocking call, as another thread may
have done a send or recv, so you should still use non-blocking mode by
specifying a zero time value, etc.  Also, events may be “coalesced”, e.g.
if multiple packets arrive quickly, we may wind up just signaling the
application once, but we do this carefully so if a message arrives *after*
we signal, it will not be lost.

I will be using this to build the SENDFD, RECVFD API for libnanomsg
compatibility.  libnng *may* implement the same socket options directly — I
haven’t decided yet.  (I hate this mode of operation, but I understand why
some users need it.)

Oh one other thing — if you use Windows you need to use both a modern
version of Windows — Windows Vista or later — *and* you need to use Visual
Studio 13 or better.  The version 12 stuff is missing some things — such as
a functional snprintf — that make me want strongly to avoid messing with
it.  Since the latest compilers are freely available, I don’t see any
reason to continue to support the older ones on Windows platforms.

(All that said, the framework for supporting other systems, including
really ancient Win95 or WinXP, or whatever, is already there.  The
developer who wants to do that is going to have to supply some missing
functionality — like condition variables, and probably also use the older
AsyncIO framework instead of overlapped IO, but the possibility *does*
exist.)

 - Garrett

Other related posts: