Questions tagged [nanomsg]

nanomsg is a socket library that provides several common communication patterns. It aims to make the networking layer fast, scalable, and easy to use.

was initiated by efforts from Martin Sústrik, the creator of ZeroMQ, nanomsg, and gets further evolved past version 1.1.2+ released in 2017/Q4

import nnpy
# ----------------------------------------# DEF SOCKET ARCHETYPE ACCESS-POINTS:
p1 = nnpy.Socket( nnpy.AF_SP, nnpy.PAIR )
p2 = nnpy.Socket( nnpy.AF_SP, nnpy.PAIR )

# ----------------------------------------# SET TRANSPORT CLASS(-es) TO BE USED:
p1.bind(    'inproc://pairExcellence' )   # p1.bind(    'ipc:///tmp/pair' )
p2.connect( 'inproc://pairExcellence' )   # p2.connect( 'ipc:///tmp/pair' )

# ----------------------------------------# USE THEM TO SEND MESSAGES:
p1.send( 'hello, p2' ); p1.send( 'I am p1' )

# ----------------------------------------# AND ENJOY THE AUTOMATED DETAILS:
print( "P2 RECV'd: {0:}".format( p2.recv() ) ); p2.send( 'nice to meet you' )
print( "P1 RECV'd: {0:}".format( p1.recv() ) )
print( "P2 RECV'd: {0:}".format( p2.recv() ) )

INTRO:

The concept still uses a word socket for naming a communication channel, yet it is rather a well abstracted socket, than a POSIX-compliant socket one may have been used to - let us view these abstracted sockets as rather a pre-wired behaviour archetype, that was encoded into their operations:

  • a PAIR - a simple archetype for one-to-one communication

  • a BUS - an archetype for a simple many-to-many communication

  • a REQREP - archetype that allows to build clusters of stateless services to process user requests

  • a PUBSUB - an archetype that distributes messages to large sets of interested subscribers

  • a PIPELINE - archetype aggregates messages from multiple sources and load balances them among many destinations

  • a SURVEY - archetype allows to query state of multiple applications in a single go


NOT A SOCKET AS A SOCKET?

To understand better the breadth of the potential setup and configuration options, one may first notice:

  1. The abstracted-socket access-point may be either "connected" ( using a call to nn_connect() ) towards another access-point present and ready at some remote infrastructure address or "bound" ( using nn_bind ) which instantiates such a service access-point for the former one.
  2. There may be multiple connects and binds on a single abstracted socket instance.
  3. There are certain socket configuration options that may be set or changed by programmer.

DOCUMENTATION:

While nanomsg borrows a lot from Martin Sústrik's work on ZeroMQ, there are principal differences and other language-specific details documented here.

80 questions
0
votes
1 answer

How to change the nanomsg pipeline load balancing logic?

I'm hoping to use something like nanomsg (or ZeroMQ). Specifically the pipeline pattern. Instead of a round-robin method for sending out the data, I would like to load balance based on the data.Any suggestions?
GrkEngineer
  • 2,122
  • 19
  • 20
0
votes
1 answer

fatal error: sys/eventfd.h: No such file or directory

I try to build nanomsg for Android ~/work/android-ndk-r10e/ndk-build and I have error: In file included from /home/roman/work/Nano/app/jni/src/utils/efd.c:28:0: /home/roman/work/Nano/app/jni/src/utils/efd_eventfd.inc:27:25: fatal error:…
Puzirki
  • 442
  • 5
  • 16
0
votes
1 answer

What pub/sub protocols have subscriber based data propagation?

I'm trying to evaluate different pub/sub messaging protocols on their ability to horizontally scale without producing unnecessary cross chatter. My architecture will have NodeJS servers with web socket clients connected. I plan on using a consistent…
user1363145
  • 107
  • 1
  • 2
  • 6
0
votes
0 answers

nanomsg: Segmentation fault when using cmake

I'm using nanomsg for request/receive and the code I have works just fine when I compiled it using a Makefile. However when I try using cmake, it compiles just fine but runs into Segmentation Fault when trying to send a message. Does anyone know…
carence
  • 87
  • 9
0
votes
1 answer

Can't link in libnanomsg for Windows MinGW, cross compiling using MXE

I am trying to build nanomsg on mingw, cross compiling from ubuntu using mxe. The target host is x86_64. I built it fine but it won't link. I am getting issues like undefined reference to 'imp__nn_freemsg' I think it's a static lib issue. I built…
Matthew Darnell
  • 1,315
  • 2
  • 12
  • 24
1 2 3 4 5
6