OutWit.Communication.Server.MMF 3.2.0

dotnet add package OutWit.Communication.Server.MMF --version 3.2.0
                    
NuGet\Install-Package OutWit.Communication.Server.MMF -Version 3.2.0
                    
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="OutWit.Communication.Server.MMF" Version="3.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OutWit.Communication.Server.MMF" Version="3.2.0" />
                    
Directory.Packages.props
<PackageReference Include="OutWit.Communication.Server.MMF" />
                    
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 OutWit.Communication.Server.MMF --version 3.2.0
                    
#r "nuget: OutWit.Communication.Server.MMF, 3.2.0"
                    
#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 OutWit.Communication.Server.MMF@3.2.0
                    
#: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=OutWit.Communication.Server.MMF&version=3.2.0
                    
Install as a Cake Addin
#tool nuget:?package=OutWit.Communication.Server.MMF&version=3.2.0
                    
Install as a Cake Tool

OutWit.Communication.Server.MMF

Memory-mapped file transport server for WitRPC, allowing a server to listen for client connections via a shared memory segment (for high-performance on-machine communication).

Overview

OutWit.Communication.Server.MMF enables a WitRPC server to communicate with clients through a Memory-Mapped File. This transport is intended for on-machine scenarios where the server and client processes share the same physical machine and memory. The server creates or opens a memory-mapped file with a given name (and size) and waits for a client to connect to that shared memory region. The MMF transport offers extremely fast communication (memory-speed reads/writes) and minimal latency since it bypasses networking entirely.

Typical use cases include launching a background "worker" process for intensive computations and communicating with it via shared memory, or any scenario requiring very high throughput between two processes on one machine. Essentially, it's like creating a private high-speed bus between your processes.

Important: This server transport must be paired with OutWit.Communication.Client.MMF on the client side. Both sides need to use the same memory-mapped file name to establish the connection. The MMF transport is one-to-one by design: one server and one client per channel name, which is exactly the host ↔ worker shape it exists for. When a client disconnects, the next client gets a fresh channel — but there is never more than one client at a time on one name. If you need multiple concurrent clients, use multiple distinct MMF channels (one name per client) or the named pipes transport, which natively supports multiple clients.

Version note: the channel layout changed in WitRPC 3.0 (lossless two-region design, see below). Both processes must run 3.0 — a 2.x peer cannot attach to a 3.0 channel. For a local link where you control both ends this is a one-time coordinated update.

Installation

Install-Package OutWit.Communication.Server.MMF

Usage

To use the memory-mapped file transport on the server, configure it with a file name (and optionally a size in bytes for the memory region):

using OutWit.Communication.Server;
using OutWit.Communication.Server.MMF;
using OutWit.Communication.Serializers;

var server = WitServerBuilder.Build(options =>
{
    options.WithService(new MyService());
    // Create a memory-mapped file transport named "MySharedMap" with 1,000,000 bytes of memory:
    options.WithMemoryMappedFile("MySharedMap", size: 1000000);
    options.WithJson();
    options.WithEncryption();  // optional: enable encryption even for local memory communication
});
server.StartWaitingForConnection();
Console.WriteLine("Memory-mapped file server ready (MySharedMap).");

On the client side (OutWit.Communication.Client.MMF), you would call options.WithMemoryMappedFile("MySharedMap") with the same name to connect.

When the server starts, it allocates a memory-mapped file of the specified size (or a default size if not specified) and waits for a client process to attach. The region is split into two equal halves, one per direction, each with its own pair of synchronization events: the writer waits for the reader to free the slot before writing the next chunk, so no frame can ever be overwritten and no signal can be lost. Messages larger than a directional region are chunked transparently.

Behavior: The server serves exactly one client at a time (see the one-to-one note above). When that client disconnects — gracefully or by dying — the server detects it (peer presence is tracked through a named mutex, which the OS abandons if the owning process exits, so no heartbeats are needed) and hands the next client a fresh channel on the same name. A reconnecting client always lands on a fresh transport instance.

Security: All kernel objects backing the channel (the mapped file, its events and mutexes) are created in the session-local Local\ namespace — processes in other sessions cannot see them. Any process in the same session with the same rights could still attempt to attach by name, so:

  • Use a unique, hard-to-guess name for the MMF.

  • Rely on operating system user account isolation (e.g., run both processes under the same user and no other user).

  • You can also leverage WitRPC's token auth (WithAccessToken) even in this scenario; the client would need the correct token to make valid requests (an unauthorized process that just opens the MMF wouldn't have the token).

  • If extremely sensitive, enable WithEncryption() — in 3.0 this is authenticated AES-256-GCM, so another process reading the memory sees only ciphertext, and any tampering with frames is detected and rejected.

Performance: Memory-mapped file transport can deliver very high throughput for large data exchange (since it's essentially memory copy operations). The size is split into the two directional regions, and a message larger than a region is chunked — so size is a throughput knob (fewer, larger chunks for big payloads), not a hard cap on message size. Avoid making the size excessively large as it will reserve that amount of memory.

Further Documentation

See the WitRPC documentation for more on the memory-mapped file transport and guidance on scenarios and performance tuning for MMF communications.

License

Licensed under the Apache License, Version 2.0. See LICENSE.

Attribution (optional)

If you use OutWit.Communication.Server.MMF in a product, a mention is appreciated (but not required), for example: "Powered by WitRPC (https://witrpc.io/)".

Trademark / Project name

"WitRPC" and the WitRPC logo are used to identify the official project by Dmitry Ratner.

You may:

  • refer to the project name in a factual way (e.g., "built with WitRPC");
  • use the name to indicate compatibility (e.g., "WitRPC-compatible").

You may not:

  • use "WitRPC" as the name of a fork or a derived product in a way that implies it is the official project;
  • use the WitRPC logo to promote forks or derived products without permission.
Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net7.0-windows7.0 is compatible.  net8.0-windows was computed.  net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net9.0-windows7.0 is compatible.  net10.0-windows was computed.  net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.2.0 128 9/8/2026
3.1.0 114 8/29/2026
3.0.0 112 8/29/2026
2.4.0 123 8/9/2026
2.3.4 149 4/23/2026
2.3.3 125 4/22/2026
2.3.2 130 3/20/2026
2.3.1 141 1/25/2026
2.3.0 493 12/9/2025
2.2.0 324 11/14/2025
2.1.0 254 9/11/2025
2.0.1 180 7/5/2025
2.0.0 171 6/7/2025
1.2.0 223 2/28/2025
1.1.1 227 2/1/2025
1.1.0 207 1/25/2025
1.0.2 204 1/11/2025
1.0.0 236 1/2/2025