GithubHelp home page GithubHelp logo

smartfire / wirebus.net Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bytenik/wirebus.net

0.0 3.0 0.0 371 KB

WireBus.NET is a loose wrapper around the .NET network I/O libraries. It allows arbitrary byte blobs to be sent down the wire using an extremely low-overhead protocol, rather than relying on byte-oriented connections. It also supports reply semantics.

License: Apache License 2.0

C# 100.00%

wirebus.net's Introduction

WireBus.NET is a loose wrapper around the .NET network I/O libraries. It allows arbitrary byte blobs to be sent down the wire rather than relying on byte-oriented connections. It also supports reply semantics.

Using WireBus is extremely simple. To wait for connections, create a WireBusListener and accept connections, much like you would do with a TcpListener:

var host = new WireBusListener(1234); // listen on port 1234
host.Start();
var serverTask = host.AcceptWireBusAsync();
var wirebus = serverTask.Result;

To connect to a WireBus.NET host, use the static Connect method on WireBusClient:

var wirebus = WireBusClient.Connect("localhost", 1234); // connect to localhost:1234

Send messages to the other peer using the Send or SendAsync methods:

var message = new byte[] { ... };
wirebus.Send(message);

Received messages are wrapped into a context object that allows you to get at the underlying message data as well as reply to request messages.

Send a request message and wait for a reply with the SendRequest or SendRequestAsync methods:

var message = new byte[] { ... };
var responseCtx = wirebus.SendRequest(message);

Receive a message from the other peer with the Receive or ReceiveAsync methods:

var ctx = wirebus.Receive();
// ctx.Data is the message content

Reply to a message with the context's Reply or ReplyAsync method:

var message = new byte[] { ... };
ctx.Reply(message);

We use this library at FivePM Technology, Inc. to efficiently send messages between our on-vehicle computers and our cloud-based platform. However, we think that this library will be useful for many other purposes and hope you find it useful for your project.

Bitdeli Badge

wirebus.net's People

Contributors

bytenik avatar bitdeli-chef avatar

Watchers

James Cloos avatar DY avatar  avatar

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.