NanomsgNG.NET.Shared 1.6.1

dotnet add package NanomsgNG.NET.Shared --version 1.6.1                
NuGet\Install-Package NanomsgNG.NET.Shared -Version 1.6.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NanomsgNG.NET.Shared" Version="1.6.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NanomsgNG.NET.Shared --version 1.6.1                
#r "nuget: NanomsgNG.NET.Shared, 1.6.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NanomsgNG.NET.Shared as a Cake Addin
#addin nuget:?package=NanomsgNG.NET.Shared&version=1.6.1

// Install NanomsgNG.NET.Shared as a Cake Tool
#tool nuget:?package=NanomsgNG.NET.Shared&version=1.6.1                

NanomsgNG.NET (nng.NET)

Fork from jeikabu/nng.NETCore:

  • NNG v1.8.0
  • Added TLS support with mbedtls libraries added to the runtime (v3.6.0)
  • Fix Disposable Interface implementation
  • Target .NET 8

.NET bindings to NNG:

NNG, like its predecessors nanomsg (and to some extent ZeroMQ), is a lightweight, broker-less library, offering a simple API to solve common recurring messaging problems, such as publish/subscribe, RPC-style request/reply, or service discovery. The API frees the programmer from worrying about details like connection management, retries, and other common considerations, so that they can focus on the application instead of the plumbing.

Status:

Using latest NNG release.

NuGet GithubActions codecov

For list of missing APIs/features see issues (is:open label:enhancement).

Goals of nng<span>.</span>NET:

  • Async first: async/await access to nng_aio and nng_ctx
  • Native layer: P/Invoke in separate files/namespace. Don't like our high-level OO wrapper? Re-use the pinvoke and make your own. Also makes cross-platform-friendly pinvoke easier.
  • Tests as Documentation: xUnit unit/integration tests in "plain" C# similar to application code
  • Modern .NET: C# 7.3 and using dotnet and targeting .NET Standard and .NET Core/5 from the start
  • Safety: Minimal exceptions and null, type system avoids many runtime errors at compile time.
  • Simple: Shallow class hierarchy (more composition than inheritance), idiomatic C# similar to original native code when reasonable.

Usage

Supports projects targeting:

Supported platforms:

  • Windows Vista or later 32/64-bit (built on Windows Server 2019)
  • macOS/OSX 10.?+ 64-bit (built on 10.15)
  • Linux x86_64, ARM32/armv7l, ARM64/aarch64 (built on Debian 10/Buster)

Should be easy to add others that are supported by both .NET Core/5 and NNG.

After installing the package and building, your output folder should have runtimes/ directory containing native binaries.

Use NngLoadContext (or your own AssemblyLoadContext) to load the appropriate native library and use NNG:

var path = Path.GetDirectoryName(typeof(Program).Assembly.Location);
var ctx = new nng.NngLoadContext(path);
var factory = nng.NngLoadContext.Init(ctx);
// Use factory...

See tests/ and examples/ for usage examples.

Build & Run

You should be able to build nng<span>.</span>NET for/on any platform supported by .NET Core/5:

  1. Build: dotnet build
  2. Run: dotnet run or dotnet test tests

You should be able to build the NNG native shared library for any platform supported by NNG. See scripts/build_nng.ps1 for details, but in general:

  1. Download/clone NNG source
  2. On Windows, create Command Prompt suitable for Visual Studio:
    • Run x64 Visual Studio Developer Command Prompt to create a 64-bit library (or x86 for 32-bit)
    • OR, run vcvars64.bat in cmd.exe (or vcvars32.bat)
  3. Run:
    mkdir build && cd build
    cmake -DBUILD_SHARED_LIBS=ON ..
    cmake --build .
    
  4. Copy library to appropriate directory (i.e. nng.NET/runtimes/XXX/native/)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NanomsgNG.NET.Shared:

Package Downloads
NanomsgNG.NET

.NET Core bindings to nng (https://github.com/nanomsg/nng)

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.6.1 147 7/31/2024
1.6.0 310 5/7/2024
1.5.2 209 3/21/2024
1.5.1 197 3/17/2024
1.5.0 182 3/16/2024