WTDawson.EventPipes

WTDawson.EventPipes is a C# Class library designed to make a named pipe instance event based to make it easier for interprocess communication using named pipes.

This library allows you to send data over a named pipe easily and get an event on the client side of it containing the data.

Messages are sent as bytes encoded in Base64, the content it split by a comma, the start being information about the message and the other side is the data.

Getting started

To get started, add the NuGet package to your project by either running the command below or in Visual Studio right clicking your project or solution, clicking “Manage NuGet Packages”, searching for “WTDawson.EventPipes” and installing it.

dotnet add package WTDawson.EventPipes

Once WTDawson.EventPipes is added, create an instance of EventPipes and call the Connect or ConnectAsync function to begin attempting to connect. Example:

using WTDawson.EventPipes;

namespace Testing
{
    internal class Program
    {
        static void Main(string[] args)
        {
            EventPipe eventPipe = new EventPipe("TestA", "TestB");
            eventPipe.Connect();
        }
    }
}

Do note however that calling Connect instead of ConnectAsync may clog the current thread until the client connects unless a timeout is provided.
Do not set primary the same as secondary or it will be rejected and make sure that you name the pipes, if you leave them as blank or null, it will be rejected.

I made another blog post about WTDawson.EventPipes: Using WTDawson.EventPipes to update UI from a service

Loading


Discover more from WTDawson

Subscribe to get the latest posts sent to your email.

Leave a Reply