Faster.Transport 0.0.18

There is a newer version of this package available.
See the version list below for details.
dotnet add package Faster.Transport --version 0.0.18
                    
NuGet\Install-Package Faster.Transport -Version 0.0.18
                    
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="Faster.Transport" Version="0.0.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Faster.Transport" Version="0.0.18" />
                    
Directory.Packages.props
<PackageReference Include="Faster.Transport" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Faster.Transport --version 0.0.18
                    
#r "nuget: Faster.Transport, 0.0.18"
                    
#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.
#:package Faster.Transport@0.0.18
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Faster.Transport&version=0.0.18
                    
Install as a Cake Addin
#tool nuget:?package=Faster.Transport&version=0.0.18
                    
Install as a Cake Tool

๐Ÿš€ Faster.Transport โ€” High-Performance Transport Framework for .NET

Unified Real-Time Transport Layer for .NET 6โ€“9 Applications
Fastest way to build zero-copy, low-latency, full-duplex communication across TCP, UDP, IPC, and In-Process backends.

Faster.Transport delivers a single unified abstraction โ€” IParticle โ€” for all transport modes:

  • ๐Ÿง  Inproc โ€“ ultra-fast in-memory messaging inside a single process
  • ๐Ÿงฉ IPC (Inter-Process Communication) โ€“ high-speed shared-memory transport
  • โšก TCP โ€“ reliable, framed, full-duplex network transport
  • ๐Ÿ“ก UDP โ€“ multicast, broadcast, and real-time datagram transport

โœ… All transports share:

  • Unified async APIs
  • Zero-allocation send/receive
  • Zero-copy buffer reuse
  • Consistent event-driven model

๐Ÿงฑ Architecture Overview

Transport Description Best Use Backing Technology
๐Ÿง  Inproc In-memory transport for subsystems within one process Internal pipelines, game engines Lock-free ring buffer
๐Ÿงฉ IPC Cross-process communication via shared memory Multi-process backends, simulators Memory-mapped files + SPSC rings
โšก TCP Reliable, ordered, framed byte stream External client/server comms Async Sockets (length-prefixed frames)
๐Ÿ“ก UDP Lightweight, low-latency datagram transport Real-time telemetry, broadcast, multicast Datagram sockets with multicast groups

๐Ÿงฉ IParticle โ€” Unified Transport Interface

Every transport implements the same high-performance contract:

public interface IParticle : IDisposable
{
    Action<IParticle, ReadOnlyMemory<byte>>? OnReceived { get; set; }
    Action<IParticle>? OnDisconnected { get; set; }
    Action<IParticle>? OnConnected { get; set; }

    ValueTask SendAsync(ReadOnlyMemory<byte> payload);
    void Send(ReadOnlySpan<byte> payload);
}

All modes โ€” TCP, UDP, IPC, and Inproc โ€” share this exact API.


โš™๏ธ Building Transports with ParticleBuilder

ParticleBuilder provides a unified fluent API to construct any transport โ€” client or server.

var particle = new ParticleBuilder()
    .UseMode(TransportMode.Tcp)
    .WithRemote(new IPEndPoint(IPAddress.Loopback, 9000))
    .OnConnected(p => Console.WriteLine("Connected!"))
    .OnReceived((p, data) => Console.WriteLine($"Received {data.Length} bytes"))
    .Build();

โšก TCP Examples

๐Ÿง  TCP Client

var client = new ParticleBuilder()
    .UseMode(TransportMode.Tcp)
    .WithRemote(new IPEndPoint(IPAddress.Loopback, 9500))
    .OnConnected(p => Console.WriteLine("โœ… TCP connected"))
    .OnReceived((p, msg) =>
        Console.WriteLine($"๐Ÿ“ฉ TCP: {Encoding.UTF8.GetString(msg.Span)}"))
    .Build();

await client.SendAsync(Encoding.UTF8.GetBytes("Hello TCP!"));

๐Ÿงฑ TCP Server (Reactor Mode)

var server = new ParticleBuilder()
    .UseMode(TransportMode.Tcp)
    .AsServer(true)
    .WithLocal(new IPEndPoint(IPAddress.Any, 9500))
    .OnConnected(p => Console.WriteLine("๐ŸŸข Client connected"))
    .OnReceived((p, msg) =>
    {
        Console.WriteLine($"Server got: {Encoding.UTF8.GetString(msg.Span)}");
        p.Send("Echo"u8.ToArray());
    })
    .Build();

๐Ÿ’ก The TCP server uses the high-performance Reactor architecture โ€”
zero allocations, async accept loop, and automatic per-client Particle management.


๐Ÿ“ก UDP Example โ€” Full-Duplex Mode

Single socket handles both send and receive operations efficiently.

var port = 9700;

var udp = new ParticleBuilder()
    .UseMode(TransportMode.Udp)
    .WithLocal(new IPEndPoint(IPAddress.Any, port))
    .WithRemote(new IPEndPoint(IPAddress.Loopback, port))
    .AllowBroadcast(true)
    .OnConnected(p => Console.WriteLine("UDP ready"))
    .OnReceived((p, msg) =>
        Console.WriteLine($"๐Ÿ“จ {Encoding.UTF8.GetString(msg.Span)}"))
    .Build();

await udp.SendAsync(Encoding.UTF8.GetBytes("Ping via UDP!"));

๐ŸŒ UDP Multicast Example

Broadcast to all peers in a multicast group โ€” perfect for telemetry or discovery.

var group = IPAddress.Parse("239.0.0.123");
var port = 9700;

var peer = new ParticleBuilder()
    .UseMode(TransportMode.Udp)
    .WithMulticast(group, port, disableLoopback: false)
    .OnConnected(p => Console.WriteLine("โœ… Joined multicast group"))
    .OnReceived((p, msg) =>
        Console.WriteLine($"๐Ÿ“ฉ {Encoding.UTF8.GetString(msg.Span)}"))
    .Build();

await peer.SendAsync(Encoding.UTF8.GetBytes("Hello multicast group!"));

๐Ÿ’ก Use disableLoopback: true to prevent receiving your own packets.


๐Ÿง  In-Process (Inproc) Example

Super-fast in-memory message passing (no kernel overhead).

// Server
var server = new ParticleBuilder()
    .UseMode(TransportMode.Inproc)
    .WithChannel("demo", isServer: true)
    .OnReceived((p, msg) =>
    {
        Console.WriteLine($"[Server] {Encoding.UTF8.GetString(msg.Span)}");
        p.Send("Echo"u8.ToArray());
    })
    .Build();

// Client
var client = new ParticleBuilder()
    .UseMode(TransportMode.Inproc)
    .WithChannel("demo")
    .OnReceived((p, msg) =>
        Console.WriteLine($"[Client] Reply: {Encoding.UTF8.GetString(msg.Span)}"))
    .Build();

await client.SendAsync("Ping"u8.ToArray());

๐Ÿงฉ IPC Example โ€” Cross-Process Messaging

High-speed interprocess communication using shared memory and SPSC rings.

// Server
var server = new ParticleBuilder()
    .UseMode(TransportMode.Ipc)
    .WithChannel("shared-mem", isServer: true)
    .OnReceived((p, msg) =>
    {
        Console.WriteLine($"[Server] {Encoding.UTF8.GetString(msg.Span)}");
        p.Send("Ack"u8.ToArray());
    })
    .Build();

// Client
var client = new ParticleBuilder()
    .UseMode(TransportMode.Ipc)
    .WithChannel("shared-mem")
    .OnReceived((p, msg) =>
        Console.WriteLine($"[Client] Got: {Encoding.UTF8.GetString(msg.Span)}"))
    .Build();

await client.SendAsync("Hi IPC!"u8.ToArray());

โš™๏ธ Common Builder Options

Method Description
.UseMode(TransportMode) Selects transport backend
.AsServer(bool) Enables server mode (TCP, IPC, or Inproc)
.WithLocal(IPEndPoint) Sets the local bind address
.WithRemote(IPEndPoint) Sets the remote endpoint
.WithMulticast(IPAddress, int, bool) Joins a UDP multicast group
.AllowBroadcast(bool) Enables UDP broadcast
.WithChannel(string, bool) Sets the channel name (IPC/Inproc)
.WithBufferSize(int) Configures per-connection buffer size
.WithParallelism(int) Controls async send parallelism
.WithTcpBacklog(int) Sets TCP server backlog size
.WithAutoReconnect(double, double) Enables exponential reconnect retry
.OnReceived(Action<IParticle, ReadOnlyMemory<byte>>) Handler for incoming data
.OnConnected(Action<IParticle>) Invoked when ready or connected
.OnDisconnected(Action<IParticle>) Invoked when closed/disconnected

๐Ÿงช Benchmark Results (.NET 9, x64, Release)

Transport Scenario Messages Mean Allocated Notes
๐Ÿง  Inproc 10k async messages 10 000 0.8 ms ๐Ÿ† 956 KB Lock-free ring buffer
๐Ÿงฉ IPC 10k async messages 10 000 1.8 ms 184 B Shared memory (MMF)
โšก TCP 10k async messages 10 000 76.8 ms 1.3 MB SAEA framed protocol
๐Ÿ“ก UDP (Unicast) 10k datagrams 10 000 92.8 ms 1.6 MB Datagram sockets
๐Ÿ“ก UDP (Multicast) 10k datagrams 10 000 502.2 ms 1.6 MB Multicast group

All benchmarks executed using BenchmarkDotNet on .NET 9.0
CPU: AMD Ryzen 9 5950X | 64 GB DDR4 | Windows 11 x64


๐Ÿ” Keywords for Developers

Tags:
.NET transport layer, .NET networking, zero-copy IPC, shared memory communication,
low latency TCP, UDP multicast broadcast, async sockets,
real-time telemetry, message bus, lock-free ring buffer, C# networking library

Use Cases:
Real-time trading ยท Game networking ยท Simulation ยท Distributed telemetry ยท Robotics ยท HFT systems


๐Ÿงพ License

MIT ยฉ 2025 โ€” Faster.Transport Team
Optimized for real-time, low-latency, high-throughput distributed systems.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  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 Faster.Transport:

Package Downloads
Faster.Messagebus

A high-performance, low-allocation messaging bus for .NET, built on NetMQ for transport and MessagePack for efficient serialization. Designed for speed and ease of use in distributed systems.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.21 420 11/14/2025
0.0.20 244 11/8/2025
0.0.19 233 11/8/2025
0.0.18 420 11/4/2025
0.0.17 291 11/2/2025
0.0.16 280 11/2/2025
0.0.15 210 11/1/2025
0.0.14 276 10/29/2025
0.0.13 275 10/29/2025
0.0.12 282 10/29/2025
0.0.11 274 10/29/2025
0.0.10 227 10/26/2025
0.0.9 230 10/26/2025
0.0.8 223 10/24/2025
0.0.7 269 10/23/2025
0.0.6 272 10/23/2025
0.0.5 270 10/23/2025
0.0.4 265 10/23/2025
0.0.3 275 10/23/2025
0.0.2 278 10/23/2025
Loading failed