SimpleCrossFrameworkIPC 1.1.4.4

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package SimpleCrossFrameworkIPC --version 1.1.4.4
NuGet\Install-Package SimpleCrossFrameworkIPC -Version 1.1.4.4
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="SimpleCrossFrameworkIPC" Version="1.1.4.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimpleCrossFrameworkIPC --version 1.1.4.4
#r "nuget: SimpleCrossFrameworkIPC, 1.1.4.4"
#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 SimpleCrossFrameworkIPC as a Cake Addin
#addin nuget:?package=SimpleCrossFrameworkIPC&version=1.1.4.4

// Install SimpleCrossFrameworkIPC as a Cake Tool
#tool nuget:?package=SimpleCrossFrameworkIPC&version=1.1.4.4

SimpleCrossFrameworkIPC

Simple IPC between .net and .core

This is a lightversion of a IPC to be used on either .net or .core and even mixed if you like. The "fix" for the conversion is a hack and might not work for later releases.

As for 20.09.2020 it works as expected between netstandard 2.0 and .net 4.7.2.

Class is based on KrakenIPC: https://github.com/darksody/KrakenIPC and Full Duplex Pipes: https://www.codeproject.com/Articles/1179195/Full-Duplex-Asynchronous-Read-Write-with-Named-Pip

Pipes are old, why did you mesh this up

I had a asp.core application that needed to get data from a .net472 application and the only IPC that actually worked was gRPC ( https://grpc.io/ ). gRPC was overkill for my project so I wanted something simpler and tiny.

Updated 20.09.2020

Added a custom delay for the time to wait for server data for the client. Changed return method to throw an exception instead of null, to make it easier to handle timeouts in the future. Also an event is added, to ensure that you catch everything if you decide to suppress exceptions.

Usage

Server and Client need to share a common interface.

    public interface ISimple
    {
        int Number { get; }
        string Text { get; }
    }

Server contains the data in the interface, here presented as static values. You can use most common data types; int, string, char, float, double, long etc...

    public class Simple : ISimple
    {
        public int Number { get => 111; }
        public string Text { get => "Some string"; }
    }

Now create the server, all it needs is the channelname. Note that this pipe only works on localhost

    try
    {
        //Then create server
        var handler = new SimpleCrossFrameworkIPC.Server<Simple, ISimple>();
        handler.Start("Channel");

        //Pause for clients
        Console.ReadLine();

        //Stop server
        handler.Stop();
    }
    catch(Exception ex)
    {
        Console.WriteLine(ex.ToString());
    }

When a client connects it will refer to the same interface. After connection are used to receive data from the server

    int nWaitForServerDataDelay = 2000; //2 sec max waiting for data
    var client = new SimpleCrossFrameworkIPC.Client<IMySimpleService>(nWaitForServerDataDelay);

    try
    {
        //Connect with a 1 second connection timeout
        client.Connect("Channel", 1000);
        var proxy = client.GetProxy();

        //Print proxy-data to the console
        Console.WriteLine("Text: " + proxy.Text);
        Console.WriteLine("Number: " + proxy.Number.ToString());
    }
    catch(Exception ex)
    {
        Console.WriteLine(ex.ToString());
    }

Exceptionhandling is needed for the pipeconnection throws a "Connection timout" and other errors.

Complexity

I have never used this class for complex classes and support for this is unknown.

Events and public functions

Server

Events

        public event EventHandler<EventArgs> ClientConnected;
        public event EventHandler<EventArgs> ClientDisconnected;

Functions

        void Start(string Pipename)
        void Stop()
        public T GetProxy()

Client

Events

        public event EventHandler<EventArgs> ClientDisconnected;

Functions

        void Connect(string Pipename)
        void Connect(string Pipename, int Timeout)
        public void Disconnect()
        public bool IsConnected()
        void UseProxy(Action<T> callback)
        public T GetProxy()

Contribution

Any contribution is welcome 😃

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
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

Ported to .net core. Supports .net 4.7.2+ and .net standard 2.0