PipeClient 2.0.2.5

Suggested Alternatives

NamedPipeClient

Additional Details

Please use NamedPipeClient instead

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 PipeClient --version 2.0.2.5
NuGet\Install-Package PipeClient -Version 2.0.2.5
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="PipeClient" Version="2.0.2.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PipeClient --version 2.0.2.5
#r "nuget: PipeClient, 2.0.2.5"
#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 PipeClient as a Cake Addin
#addin nuget:?package=PipeClient&version=2.0.2.5

// Install PipeClient as a Cake Tool
#tool nuget:?package=PipeClient&version=2.0.2.5

Pipe Client

A Client for inter-process communication over a named pipe using a shared secret to execute a Handler

The Client sends Data to the Server so the Server can execute the Handler

Data is string

using Pipe.Com;
using PipeClientRPC;
using System.IO.Pipes;

namespace PipeClientConsole
{
    internal class PipeClientConsole
    {
        readonly static bool switchTest = true;

        static string path = "C:\\Windows\\notepad.exe";
        static string secret = "SDh&SarvecGr!eCtn@";
        static string pipeName = "testpipe";
        static string serverName = ".";

        static void Main()
        {
            bool success;

            if (switchTest)
            {
                success = PipeClient.Request(BackAndForthTest, secret, pipeName, serverName);
            }
            else
            {
                success = PipeClient.Request(ApplicationTest, secret, pipeName, serverName);
            }

            Console.WriteLine(success);
        }

        private static bool ApplicationTest(NamedPipeClientStream clientStream)
        {
            return new PipeMessage(clientStream).WriteStringWaitForRead(path) == C.SUCCESS;
        }

        private static bool BackAndForthTest(NamedPipeClientStream clientStream)
        {
            string serverResponse = new PipeMessage(clientStream).WriteStringWaitForRead("DidYouGetThis");

            if (serverResponse != null && serverResponse != C.FAILED)
            {
                try
                {
                    Console.WriteLine("Server Said: " + serverResponse);
                }
                catch
                {
                    return false;
                }

                return true;
            }

            return false;
        }
    }
}

Pipe Server

You need the PipeServer to use this

using Pipe.Com;
using PipeServerRPC;
using System.Diagnostics;
using System.IO.Pipes;

namespace PipeServerConsole
{
    internal class PipeServerConsole
    {
        readonly static bool switchTest = true;

        static readonly PipeServer PipeServer = new("testpipe", "SDh&SarvecGr!eCtn@");

        static void Main()
        {
            Console.WriteLine(PipeApplicationGlobals.ElapsedTicks);

            PipeApplicationGlobals.SetTimeoutMs(500);

            if (switchTest)
            {
                ThreadPool.QueueUserWorkItem((_) => { PipeServer.Start(BackAndForthTest); }, null);
            }
            else
            {
                ThreadPool.QueueUserWorkItem((_) => { PipeServer.Start(ApplicationTest); }, null);
            }

            Console.WriteLine("Press any key to dispose server");

            Console.ReadLine();

            PipeServer.Dispose();

            Console.WriteLine("Press any key to exit");

            Console.ReadLine();
        }

        public static void BackAndForthTest(NamedPipeServerStream serverStream, string clientWord)
        {
            string handlerResponse;

            if (clientWord == "DidYouGetThis")
            {
                handlerResponse = "Yes, I got that";
            }
            else
            {
                handlerResponse = "No, What you said is wrong";
            }

            if (!string.IsNullOrWhiteSpace(handlerResponse))
            {
                new PipeMessage(serverStream).WriteString(handlerResponse);
            }
            else
            {
                new PipeMessage(serverStream).WriteString(C.N);
            }
        }

        private static void ApplicationTest(NamedPipeServerStream serverStream, string clientResponse)
        {
            try
            {
                ProcessStartInfo psi = new()
                {
                    FileName = clientResponse,
                    UseShellExecute = true,
                    RedirectStandardError = false,
                    RedirectStandardOutput = false,
                    RedirectStandardInput = false,
                };

                Process.Start(psi);
            }
            catch
            {

            }

            new PipeMessage(serverStream).WriteString(C.SUCCESS);
        }
    }
}

Copyright S Christison �2024

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 was computed.  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 (1)

Showing the top 1 NuGet packages that depend on PipeClient:

Package Downloads
Wedonek.RpcClient

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated

NamedPipeClientRequest is now Obsolete, use Request instead or roll back to an earlier version

Examples have been updated to fix breaking changes

-----------------
Please use the most recent version visible on Nuget, old versions are hidden but can still be downloaded indirectly