forked from bytenik/WireBus.NET
/
README
22 lines (14 loc) · 1.22 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
WireBus.NET is a loose wrapper around the .NET network I/O libraries in conjunction with ProtoBuf.
It allows messages (objects) to be sent down the wire (using ProtoBuf serialization) rather than relying on manual serialization and byte-oriented connections. It also returns Tasks instead using the traditional Begin- and End- method calls.
Usage is extremely simple. To wait for connections, create a WireBusHost and retrieve connections:
var host = new WireBusHost(1234); // listen on port 1234
host.Start();
var serverTask = host.AcceptWireBusAsync();
serverTask.Wait();
var wirebus = serverTask.Result;
To connect to a WireBus.NET host, use the static Connect method on WireBus:
var wirebus = WireBus.Connect("localhost", 1234); // connect to localhost:1234
Send messages to the other peer using the Send method:
var message = new DomainMessageType() { ... };
wirebus.Send(message);
We use this library at FivePM Technology, Inc. to efficiently forward messages from a queue over cellular connections between 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.