EasyPipes 1.3.0

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

// Install EasyPipes as a Cake Tool
#tool nuget:?package=EasyPipes&version=1.3.0                

EasyPipes

Simple C# library for NamedPipe and TCP-based IPC

Written against .NET Standard 2.0, ought to be compatible with most modern .NET versions.

Usage

Server usage:

using EasyPipes;

// IService defines the IPC interface
public interface IService
{
   int Sum(int one, int two);
}

// Calculator is the server class
class Calculator : IService
{
   public int Sum(int one, int two)
   {
      return one + two;
   }
}

// start up
Server server = new Server("pipename");
server.RegisterService<IService>(new Calculator());
server.Start();

// eventual shutdown
server.Stop();

Client usage:

using EasyPipes;

// IService defines the IPC interface
public interface IService
{
   int Sum(int one, int two);
}

// setup client
Client client = new Client("pipename");
IService service = client.GetServiceProxy<IService>();

// execute remote operation
int result = service.Sum(6, 12); // = 18

Encrypted TCP:

using EasyPipes;

/// IService defines the IPC interface
public interface IService
{
	bool Authenticate(string username, string password);

	string GetSecretData();
}

// --------- SERVER --------------
class StatefulService : IService
{
	private bool has_authenticated = false;

	[EncryptIfTrue]
	public bool Authenticate(string username, string password)
	{
		if(Authenticated(username, password))
		{
			this.has_authenticated = true;
			return true;
		} else {
			return false;
		}
	}

	public string GetSecretData()
	{
		if(has_authenticated)
			return somesecretstuff;
		else
			throw new Exception("Not authenticated");
	}
}

// start up
TcpServer server = new TcpServer(new IPEndPoint(address, port), new Encryptor(sharedkey));
server.RegisterStatefulService<IService>(typeof(StatefulService));
server.Start();

// eventual shutdown
server.Stop();

// --------- CLIENT -------------
// setup client
TcpClient client = new TcpClient(new IPEndPoint(address, port), new Encryptor(sharedkey));
IService service = client.GetServiceProxy<IService>();

// authenticate (transmitted in plaintext!)
if(service.Authenticate(username, password))
{
	// transmit encrypted messages
	string data = service.GetSecretData();
}

Remarks:

  • By default there is a single instance of the server class used by all clients! Use the stateful service for service which require an instance per connection.
  • It's primarily focussed on IPC on single-machine or swift LAN-connections, so it likely will not perform well with long-distance internet connections.
  • Any and all arguments or return values are serialized using DataContractSerializer, so custom types that need to cross the connection should be designed accordingly.
  • Provides optional AES256 encryption for TCP connections upon call to a labelled service method, for example after authentication

Licence

Mozilla Public Licence 2.0

In simple terms: You can use the library as-is for any of your own projects, but any changes to the library itself have to be available under the same terms.

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 EasyPipes:

Package Downloads
Alternet.Studio.Scripter.Debugger

AlterNET Scripter is a component library designed to integrate C#, Visual Basic, TypeScript, JavaScript, Python, and IronPython scripts into your WinForms and WPF .NET desktop applications. It allows extending the application logic by implementing custom functionality or automating custom tasks without recompiling and redeploying the application. This package includes a ScriptDebugger component, which provides a debugging engine for C# and VisualBasic scripts, supporting Start, Stop, Break, and Continue commands, step-by-step execution, breakpoints, expression evaluation, viewing local variables, watches, stack tracing and multiple thread debugging. This multi-target package can be used with .NET applications targeting .NET Framework starting from 4.6.2 or .NET 6 / .NET 7 / .NET 8 More information about Scripter can be found here: https://www.alternetsoft.com/products/scripter Documentation and sample projects can be downloaded here: https://www.alternetsoft.com/download NOTE: This is a commercial software product and requires purchasing a license for legal usage. Please refer to our licensing FAQ here: https://www.alternetsoft.com/faq#license

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on EasyPipes:

Repository Stars
ConcreteMC/Alex
A Minecraft client written in C# aimed at compatibility with MC:Java & MC:Bedrock
Version Downloads Last updated
1.3.0 25,286 2/20/2021
1.2.0 3,501 4/8/2020
1.1.0 5,608 10/22/2018
1.0.0 728 10/22/2018

Better ValueType support and custom NamedPipeServerStream construction