OrangeCabinet 0.0.6

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

// Install OrangeCabinet as a Cake Tool
#tool nuget:?package=OrangeCabinet&version=0.0.6                

OrangeCabinet - C# .NET async udp server & client

nuget .NET CI codecov License

feature

  • Callback for 'Incoming'(received), 'Timeout'(timeout), 'Shutdown'(shutdown).
  • Can store user value in remote.
  • Check timeout at regular intervals by last receive time.
  • Client bind too, not connect. So, previously known client port.

how to use

callback

public class Callback : OcCallback
{
    private const string Key = "inc";
    
    public override void Incoming(OcRemote remote, byte[] message)
    {
        Console.WriteLine($"Received: {Encoding.UTF8.GetString(message)} ({remote})");
        
        int inc = remote.GetValue<int>(Key);
        inc++;
        remote.SetValue(Key, inc);
        
        remote.Send($"{inc}");
        if (inc > 10)
        {
            remote.ClearValue(Key);
            remote.Escape();
        }
    }

    public override void Timeout(OcRemote remote)
    {
        Console.WriteLine($"Timeout: {remote}");
    }

    public override void Shutdown(OcRemote remote)
    {
        Console.WriteLine($"Shutdown: {remote}");
    }
}

for server

public static void Main(string[] args)
{
    var serverBinder = new OcBinder(new SampleCallback())
    {
        BindPort = 8710,
    };
    var server = new OcLocal(serverBinder);
    server.Start();
    server.WaitFor();
    // ...
    server.Shutdown();
}

for client

public static void Main(string[] args)
{
    using var clientBinder = new OcBinder(new Callback())
    {
        BindPort = 18710,
    };
    var client = new OcRemote(clientBinder, "127.0.0.1", 8710);
    for (int j = 0; j < 3; j++)
    {
        client.Send($"{j}");
    }
}
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.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on OrangeCabinet:

Package Downloads
FluentNetting

Fluent forwarded server.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.1 0 11/22/2024
0.2.0 184 4/15/2024
0.0.9 255 12/8/2023
0.0.8 348 1/4/2023
0.0.7 293 1/2/2023
0.0.6 305 12/22/2022
0.0.5 387 12/13/2022
0.0.4 622 1/24/2022
0.0.3 610 1/13/2022
0.0.2 285 12/21/2021
0.0.1 285 12/10/2021