Faster.Transport
0.0.9
See the version list below for details.
dotnet add package Faster.Transport --version 0.0.9
NuGet\Install-Package Faster.Transport -Version 0.0.9
<PackageReference Include="Faster.Transport" Version="0.0.9" />
<PackageVersion Include="Faster.Transport" Version="0.0.9" />
<PackageReference Include="Faster.Transport" />
paket add Faster.Transport --version 0.0.9
#r "nuget: Faster.Transport, 0.0.9"
#:package Faster.Transport@0.0.9
#addin nuget:?package=Faster.Transport&version=0.0.9
#tool nuget:?package=Faster.Transport&version=0.0.9
๐ Faster.Transport
Faster.Transport is a high-performance, unified transport layer for .NET that abstracts multiple communication backends โ including In-Process, Shared Memory (IPC), TCP, and UDP / Multicast โ under a single IParticle interface.
It is designed for ultra-low-latency, high-throughput messaging across local, inter-process, and network boundaries.
โจ Features
| Feature | Description |
|---|---|
| ๐ง Unified API | All transports implement IParticle with Send, SendAsync, OnReceived, OnConnected, and OnDisconnected. |
| โก Zero-Copy Messaging | Uses ReadOnlyMemory<byte> and pooled buffers for minimal GC pressure. |
| ๐งฉ Multiple Backends | Supports Inproc, IPC, TCP, and UDP / Multicast. |
| ๐ฌ Bi-Directional Communication | Every IParticle is full-duplex: send and receive simultaneously. |
| ๐งต Thread-Safe | Built for high concurrency using lock-free queues. |
| ๐ฐ๏ธ Multicast Support | Native UDP multicast support with TTL, loopback control, and auto configuration. |
| ๐งฐ Fluent Builder DSL | Configure and build transports using a single fluent interface (ParticleBuilder). |
๐งฑ Supported Transports
| Transport | Description | Use Case |
|---|---|---|
| ๐งฉ Inproc | In-process memory channel, zero allocations | Testing, simulations, multi-component apps |
| ๐พ IPC | Shared-memory transport via mapped files | Cross-process, same machine |
| ๐ TCP | Network transport, reliable streaming | Client-server, LAN, remote |
| ๐ก UDP | Datagram transport, supports unicast & multicast | Telemetry, broadcast, discovery |
โ๏ธ Benchmark Results
All benchmarks were run using BenchmarkDotNet on a .NET 9.0 build targeting x64 in Release mode.
๐งฉ Inproc Transport (Single Process)
| Method | Mean | Error | StdDev | Median | Allocated |
|---|---|---|---|---|---|
| ๐ SendAsync 10k messages | 5.080 ms | 7.134 ms | 4.719 ms | 2.260 ms | 956.79 KB |
Interpretation:
๐ The Inproc transport achieves ~2.2 ms median latency for 10,000 asynchronous message sends,
with under 1 MB total allocations, demonstrating near-zero overhead and outstanding local throughput.
๐ง Quick Start
1๏ธโฃ Create a TCP echo server and client
using Faster.Transport;
using System.Net;
using System.Text;
// ๐ฅ๏ธ Server
var server = new ParticleBuilder()
.UseMode(TransportMode.Tcp)
.BindTo(new IPEndPoint(IPAddress.Loopback, 5000))
.OnReceived((p, msg) =>
{
Console.WriteLine($"Server received: {Encoding.UTF8.GetString(msg.Span)}");
p.Send(msg.Span); // echo back
})
.Build();
// ๐ป Client
var client = new ParticleBuilder()
.UseMode(TransportMode.Tcp)
.ConnectTo(new IPEndPoint(IPAddress.Loopback, 5000))
.OnReceived((_, msg) =>
Console.WriteLine($"Client got echo: {Encoding.UTF8.GetString(msg.Span)}"))
.Build();
await Task.Delay(200); // wait for connect
await client.SendAsync(Encoding.UTF8.GetBytes("Hello TCP!"));
2๏ธโฃ In-Process Messaging
var server = new ParticleBuilder()
.UseMode(TransportMode.Inproc)
.WithChannel("local-bus", isServer: true)
.OnReceived((_, msg) =>
Console.WriteLine($"Server received: {Encoding.UTF8.GetString(msg.Span)}"))
.Build();
var client = new ParticleBuilder()
.UseMode(TransportMode.Inproc)
.WithChannel("local-bus")
.Build();
await client.SendAsync(Encoding.UTF8.GetBytes("Ping Inproc!"));
3๏ธโฃ IPC (Shared Memory)
var server = new ParticleBuilder()
.UseMode(TransportMode.Ipc)
.WithChannel("shared-map", isServer: true)
.OnReceived((_, msg) =>
Console.WriteLine($"IPC Server: {Encoding.UTF8.GetString(msg.Span)}"))
.Build();
var client = new ParticleBuilder()
.UseMode(TransportMode.Ipc)
.WithChannel("shared-map")
.Build();
await client.SendAsync(Encoding.UTF8.GetBytes("Hello from IPC!"));
4๏ธโฃ UDP / Multicast Messaging
Now with auto-configuring multicast โ no need to manually bind or connect!
using Faster.Transport;
using System.Net;
using System.Text;
var group = IPAddress.Parse("239.10.10.10");
var port = 50000;
// ๐ฐ๏ธ Multicast Sender
var server = new ParticleBuilder()
.EnableMulticast(group, port, disableLoopback: false)
.Build();
// ๐ก Multicast Clients
var client1 = new ParticleBuilder()
.EnableMulticast(group, port)
.OnReceived((_, msg) =>
Console.WriteLine($"Client 1 got: {Encoding.UTF8.GetString(msg.Span)}"))
.Build();
var client2 = new ParticleBuilder()
.EnableMulticast(group, port)
.OnReceived((_, msg) =>
Console.WriteLine($"Client 2 got: {Encoding.UTF8.GetString(msg.Span)}"))
.Build();
Console.WriteLine("Press ENTER to send 3 multicast messages...");
Console.ReadLine();
for (int i = 0; i < 3; i++)
{
var msg = Encoding.UTF8.GetBytes($"Broadcast #{i + 1}");
await server.SendAsync(msg);
Console.WriteLine($"[Server] Sent Broadcast #{i + 1}");
await Task.Delay(300);
}
โ Output
[Server] Sent Broadcast #1
Client 1 got: Broadcast #1
Client 2 got: Broadcast #1
...
๐งฉ ParticleBuilder Overview
| Method | Description |
|---|---|
.UseMode(TransportMode) |
Selects the backend (Tcp, Inproc, Ipc, or Udp). |
.BindTo(IPEndPoint) |
Binds to a local endpoint (for servers or UDP listeners). |
.ConnectTo(IPEndPoint) |
Connects to a remote endpoint (for clients). |
.EnableMulticast(IPAddress, int, bool) |
Configures and auto-binds a UDP multicast socket. |
.AllowBroadcast(bool) |
Enables UDP broadcast mode. |
.WithChannel(string, bool) |
Used by Inproc and IPC transports. |
.OnReceived(Action<IParticle, ReadOnlyMemory<byte>>) |
Handles incoming messages. |
.OnConnected(Action<IParticle>) |
Triggered when connection is ready. |
.OnDisconnected(Action<IParticle, Exception?>) |
Triggered when connection closes. |
.WithBufferSize(int) |
Sets per-operation buffer size. |
.WithRingCapacity(int) |
Sets internal shared memory size (IPC/Inproc). |
.WithParallelism(int) |
Sets degree of parallelism. |
๐งช Testing UDP Multicast Locally
If messages are not received:
- Ensure
disableLoopback: falsein.EnableMulticast()for local tests. - Disable the firewall or open UDP port
50000. - Verify via Wireshark: filter
udp.port == 50000. - Loopback works only if
MulticastLoopbackis enabled.
โ๏ธ Requirements
| Requirement | Minimum |
|---|---|
| .NET | .NET 9.0 or newer |
| OS | Windows, Linux, macOS |
| Recommended | .NET 8+ for maximum performance |
๐งโ๐ป Example Projects
| Project | Description |
|---|---|
Faster.Transport.Demo |
Contains TCP, Inproc, IPC, and UDP demos |
Faster.Transport.Tests |
Includes integration & multicast test suite |
Faster.Transport.Primitives |
Zero-copy buffer and ring-based queue utilities |
๐งฐ License
MIT License ยฉ 2025 โ Designed for speed, simplicity, and reliability.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net9.0
- No dependencies.
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 | 274 | 11/14/2025 |
| 0.0.20 | 170 | 11/8/2025 |
| 0.0.19 | 163 | 11/8/2025 |
| 0.0.18 | 344 | 11/4/2025 |
| 0.0.17 | 220 | 11/2/2025 |
| 0.0.16 | 212 | 11/2/2025 |
| 0.0.15 | 143 | 11/1/2025 |
| 0.0.14 | 209 | 10/29/2025 |
| 0.0.13 | 209 | 10/29/2025 |
| 0.0.12 | 205 | 10/29/2025 |
| 0.0.11 | 207 | 10/29/2025 |
| 0.0.10 | 158 | 10/26/2025 |
| 0.0.9 | 160 | 10/26/2025 |
| 0.0.8 | 149 | 10/24/2025 |
| 0.0.7 | 200 | 10/23/2025 |
| 0.0.6 | 199 | 10/23/2025 |
| 0.0.5 | 197 | 10/23/2025 |
| 0.0.4 | 186 | 10/23/2025 |
| 0.0.3 | 204 | 10/23/2025 |
| 0.0.2 | 202 | 10/23/2025 |