Git Product home page Git Product logo

pipedream's Introduction

PipeDream

.NET Standard IPC/RPC

PipeDream is a lightweight (and note: partially incomplete) IPC/RCP library that leverages named pipes.

Getting started is fairly easy -- for a quick example see below.

For a full example, check out the Tests directory. In order to run the tests, be sure to build the server executables (Build > Build Solution), and run the project ClientTest.

Client Code:

string pipeName = "myPipeName";
IMySharedInterface myRemoteInterface = PipeDream.ClientInitialize<IMySharedInterface>(pipeName);
string fullName = myRemoteInterface.AppendLastName("Sarah");

Server Code:

// Shared interface between the client and server
public interface IMySharedInterface
{
    string AppendLastName(string name);
}

// Implementation of the shared interface
class SharedInterfaceImpl : IMySharedInterface
{
    public string AppendLastName(string name)
    {
        return name + " " + "Smith";
    }
}

// Somewhere in the server code:
string pipeName = "myPipeName";
IMySharedInterface instance = new SharedInterfaceImpl();
PipeDream.ServerInitialize<IMySharedInterface>(instance, pipeName);

Advanced Topics:

Serializing non-primitive objects simply requires annotating the class with Serializeable attributes.

Known Issues:

Currently this does not support interfaces with the ref or out keywords. Also, this does not support properties on interfaces.

There is no mechanism in place yet for handling failed calls. This code currently assumes the server is always running, and will likely deadlock if the server is not present.

How it works:

For client initialization, PipeDream instantiates a dummy class that mocks the provided interface (ie IMySharedInterface in the example above). A dynamic proxy is then created on the mocked object to intercept method calls. The method body is filled with the following (pseudo-code):

SerializeArgsToPipe();
response = DeserializeResponseFromPipe();
return response;

The server wraps the implementation object, and spins off a new thread that runs the following (pseudo-code):

while (true)
{
    DeserializeArgsFromPipe();
    result = callOriginalMethod();
    SerializeResponseToPipe();
}

pipedream's People

Contributors

zcanann avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

zerocry zhouzu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.