Use the publish-subscribe pattern to broadcast sensor readings from one source to many worker processes without managing individual connections.
Build a request-reply server in C where client programs send a question over TCP and get a response back, like a lightweight remote procedure call.
Distribute work items across a pool of worker processes using the push-pull pattern for parallel processing without a message broker.
Use TLS transport to encrypt messages between services running on an untrusted network.
Build requires CMake and a C11 compiler, TLS support requires an additional TLS library such as mbedTLS or wolfSSL.
NNG is a C library that helps separate programs communicate with each other over a network, or across different threads and processes on the same machine. It handles the low-level work of connecting, reconnecting on failure, managing message queues, and routing data, so the application code can focus on what to send rather than how to send it. The library is built around a set of well-established messaging patterns. Publish-subscribe lets one sender broadcast messages to many receivers without knowing who they are. Request-reply lets a client send a question and wait for an answer, like a simple remote procedure call. Push-pull distributes work items across a pool of workers. These patterns cover the most common ways distributed software components need to talk to each other. NNG is a rewrite of an older library called nanomsg, designed to be more reliable and to scale across multiple CPU cores. Internally it uses an asynchronous event system and a thread pool so it can handle many simultaneous connections without creating one thread per connection, which would hit system limits quickly. Applications built on the original nanomsg or on a Go port called mangos can talk directly to NNG applications over the network because the wire protocol is the same. Transport options include standard TCP, in-process pipes for zero-copy communication within a single program, inter-process communication via sockets on the local machine, WebSockets, and TLS-encrypted connections for secure communication. TLS support means credentials and data can be protected in transit when running over an untrusted network. The library builds with a standard C11 compiler and CMake on Linux, macOS, Windows, FreeBSD, Android, iOS, and several other platforms. It is designed to be embedded directly into other applications and is available under the MIT license.
← nanomsg on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.