On 08/02/2013 02:31 PM, Raphael Cohn wrote:
> It's worth pointing out that it's probably as trivial change to any of
> the C implementations (client and broker) to use Unix domain sockets.
> You'll need to modify the one or two lines of source code that open a
> new socket (the call to socket() ), changing the constant AF_INET
> to AF_UNIX and using slightly different code for bind() - e.g.
>
http://beej.us/guide/bgipc/output/html/multipage/unixsock.html should
> be a good steer.
>
> For a Java implementation that DOESNT use NIO, you can use a different
> socket factory with a third party Unix domain sockets library. If it
> does use NIO, you're probably stuffed.
>
> That said, I agree with Dave Locke - local loopback TCP stacks on
> linux are really rather good, although the folks at Dolphin
> SuperSockets reckon they can do better... and the advantages as
> Stefano and Dave say of then also being able to go off box quite out
> weigh the overhead.
>
Two rather interesting examples of what we're saying here, taken from real:
(1) "Black box" that should enable integration between two home
automation related words (two different protocol standards, physical
networks, groups of devices). Inside the box two demons talk to the two
worlds and a local MQTT broker is the endpoint of all messages after
"smart" translations. Each demon pubs / subs and can make its own use of
messages. A third rather complex demon is being developed with the aim
of doing calculations, prediction algorithms, etc etc so that the two
worlds can share not only rough data but also mutual "knowledge" of the
environment. BUT: the algorithms are evolving as Matlab simulations
running on a much powerful platform (or even automated Excel sheet...)
and it's a matter of a few hours (or minutes) to connect the simulation
ins/outs to the local broker so that it behaves exactly like the
(future) third demon.
(2) "White good" with a rather complex user interface that will, may be,
in the future be duplicated as a Smartphone app. But in the meantime
having used a local broker as IPC inside the product, it's very easy to
generate an identical user interface that will run on smartphone-like
platforms and magically connects over Internet (with a few tricks and
far from optimized).
Hope this is useful in order to understand how (re)using something that
proved to be flexible and smart in other projects, is always a good idea!