NTDLS.ReliableMessaging 1.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package NTDLS.ReliableMessaging --version 1.2.1
NuGet\Install-Package NTDLS.ReliableMessaging -Version 1.2.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="NTDLS.ReliableMessaging" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NTDLS.ReliableMessaging --version 1.2.1
#r "nuget: NTDLS.ReliableMessaging, 1.2.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 NTDLS.ReliableMessaging as a Cake Addin
#addin nuget:?package=NTDLS.ReliableMessaging&version=1.2.1

// Install NTDLS.ReliableMessaging as a Cake Tool
#tool nuget:?package=NTDLS.ReliableMessaging&version=1.2.1

NTDLS.ReliableMessaging

NTDLS.ReliableMessaging provides incredibly lightweight, reliable and high-performance TCP/IP based inter-process-communication functionality. This includes a server which listens for incoming connections and a client which makes a connection to the server.

Once connected the server and the client can send fire-and-forget style notifications or dispatch queries which require a reply.

All messages are guaranteed to be received in their entirety and in the order in which they were dispatched.

Example of server and client sneding notifications and a query:

//Class used to send a notification.
internal class MyNotification : IFrameNotification
{
    public string Message { get; set; }

    public MyNotification(string message)
    {
        Message = message;
    }
}

//Class used to send a query (which expects a response).
internal class MyQuery : IFrameQuery
{
    public string Message { get; set; }

    public MyQuery(string message)
    {
        Message = message;
    }
}

//Class used to reply to a query.
internal class MyQueryReply : IFrameQueryReply
{
    public string Message { get; set; }

    public MyQueryReply(string message)
    {
        Message = message;
    }
}

static void Main()
{
    //Start a server and add a "query received" and "notification received" event handler.
    var server = new MessageServer();
    server.OnQueryReceived += Server_OnQueryReceived;
    server.OnNotificationReceived += Server_OnNotificationReceived;
    server.Start(45784);

    //Start a client and connect to the server.
    var client = new MessageClient();
    client.Connect("localhost", 45784);

    client.Notify(new MyNotification("This is message 001 from the client."));
    client.Notify(new MyNotification("This is message 002 from the client."));
    client.Notify(new MyNotification("This is message 003 from the client."));

    //Send a query to the server, specify which type of reply we expect.
    client.Query<MyQueryReply>(new MyQuery("This is the query from the client.")).ContinueWith(x =>
    {
        //If we recevied a reply, print it to the console.
        if (x.IsCompletedSuccessfully && x.Result != null)
        {
            Console.WriteLine($"Client received query reply: '{x.Result.Message}'");
        }
    });

    Console.WriteLine("Press [enter] to shutdown.");
    Console.ReadLine();

    //Cleanup.
    client.Disconnect();
    server.Stop();
}

private static void Server_OnNotificationReceived(MessageServer server, Guid connectionId, IFrameNotification payload)
{
    if (payload is MyNotification notification)
    {
        Console.WriteLine($"Server received notification: {notification.Message}");
    }
    else
    {
        throw new NotImplementedException();
    }
}

private static IFrameQueryReply Server_OnQueryReceived(MessageServer server, Guid connectionId, IFrameQuery payload)
{
    if (payload is MyQuery query)
    {
        Console.WriteLine($"Server received query: '{query.Message}'");

        //Return with a class that implements IFrameQueryReply to reply to the client.
        return new MyQueryReply("This is the query reply from the server.");
    }
    else
    {
        throw new NotImplementedException();
    }
}
Product Compatible and additional computed target framework versions.
.NET 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 is compatible.  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. 
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 NTDLS.ReliableMessaging:

Package Downloads
NTDLS.Katzebase.Client

Client for Katzebase document-based database engine for Windows and Linux.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.1 82 5/3/2024
1.5.0 52 5/2/2024
1.4.1 89 2/19/2024
1.4.0 160 2/15/2024
1.3.11 404 2/1/2024
1.3.10 256 1/31/2024
1.3.9 88 1/22/2024
1.3.8 79 1/22/2024
1.3.7 114 1/4/2024
1.3.6 93 12/29/2023
1.3.5 91 12/27/2023
1.3.4 103 12/27/2023
1.3.3 107 12/22/2023
1.3.2 88 12/21/2023
1.3.1 84 12/21/2023
1.3.0 90 12/21/2023
1.2.4 99 12/19/2023
1.2.3 105 12/18/2023
1.2.2 143 11/15/2023
1.2.1 90 11/10/2023
1.2.0 98 11/7/2023
1.1.0 88 11/7/2023
1.0.1 97 11/7/2023
1.0.0 92 11/6/2023

Updated StreamFraming framework.