UdtLib 1.0.1

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

UdtLib

UdtLib is a managed .NET 8+ implementation of the UDT (UDP-based Data Transfer) protocol.

It provides reliable, ordered, message-oriented transport over UDP through a small async API. The package is intended for applications that want UDP as the underlying transport but still need delivery guarantees and predictable message ordering.

Why UdtLib

  • Reliable delivery over UDP with retransmission on missing acknowledgements
  • Ordered message processing per session
  • Async-first API based on Task and IAsyncEnumerable<T>
  • Server and client entry points with a minimal public surface
  • Managed implementation built on System.Net.Sockets, System.Threading.Channels, and System.Buffers
  • Works with both IPv4 and IPv6 through IPEndPoint

Installation

dotnet add package UdtLib

Package contents

The package exposes four main entry points:

  • IUdtServer for accepting remote peers over UDP
  • IUdtSession for bidirectional message exchange
  • IUdtSender when only sending is needed
  • IUdtReceiver when only receiving is needed

Use IUdtServer.Create(...) to bind a server socket and UdtClient.Connect(...) to create an outbound session.

Quick start

Server

using System.Net;
using UdtLib;

var endpoint = new IPEndPoint(IPAddress.Any, 9000);

await using IUdtServer server = IUdtServer.Create(endpoint);

await foreach (IUdtSession session in server.AcceptAllAsync(cancellationToken))
{
    _ = Task.Run(() => HandleSessionAsync(session, cancellationToken));
}

static async Task HandleSessionAsync(IUdtSession session, CancellationToken cancellationToken)
{
    await using (session)
    {
        await foreach (ReadOnlyMemory<byte> message in session.ReadAllAsync(cancellationToken))
        {
            await session.SendAsync(message, cancellationToken);
        }
    }
}

Client

using System.Net;
using UdtLib;

await using IUdtSession session =
    UdtClient.Connect(new IPEndPoint(IPAddress.Loopback, 9000));

byte[] payload = "Hello, UDT!"u8.ToArray();

await session.SendAsync(payload, cancellationToken);

await foreach (ReadOnlyMemory<byte> reply in session.ReadAllAsync(cancellationToken))
{
    Console.WriteLine($"Received {reply.Length} bytes");
    break;
}

API summary

IUdtServer

Member Description
EndPoint LocalEndPoint Gets the bound local endpoint
IAsyncEnumerable<IUdtSession> AcceptAllAsync(CancellationToken) Produces a session for each newly observed remote endpoint
static IUdtServer Create(IPEndPoint endpoint) Creates and binds a server

UdtClient

Member Description
static IUdtSession Connect(IPEndPoint remote) Creates a client session connected to a remote endpoint

IUdtSession

IUdtSession combines IUdtSender, IUdtReceiver, and IAsyncDisposable.

Member Description
Task SendAsync(ReadOnlyMemory<byte> payload, CancellationToken) Sends a message reliably
IAsyncEnumerable<ReadOnlyMemory<byte>> ReadAllAsync(CancellationToken) Reads inbound messages in order
ValueTask DisposeAsync() Stops and disposes the session

Transport characteristics

  • Message-oriented: each send represents one payload
  • Reliable: sent frames are retransmitted until acknowledged
  • Ordered: inbound messages are exposed in sequence order
  • Maximum payload per frame: 65,535 bytes

UdtLib is a good fit when you want a lightweight managed UDP transport with reliability semantics, especially for message-based protocols, service-to-service communication, and controlled networking environments.

Requirements

  • .NET 8
  • .NET 10

License

BSD 3-Clause.

Source repository: https://github.com/yartat/udtsharp

Product Compatible and additional computed target framework versions.
.NET 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.  net9.0 was computed.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

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
1.0.1 114 3/17/2026
1.0.0 102 3/17/2026

Initial release — reliable, ordered UDP transport for modern .NET.