C# Class WireBus.WireBusClient

A WireBus client, responsible for wrapping a TCP/IP connection and serializing the data going over the bus.
Inheritance: IDisposable
Show file Open project: bytenik/WireBus.NET Class Usage Examples

Public Methods

Method Description
Connect ( IPAddress host, int port, ConnectionSemantics semantics = newConnectionSemantics() ) : WireBusClient

Connect to a peer, returning a new bus.

Connect ( string host, int port, ConnectionSemantics semantics = newConnectionSemantics() ) : WireBusClient

Connect to a peer, returning a new bus.

ConnectAsync ( IPAddress host, int port, CancellationToken token, ConnectionSemantics semantics = newConnectionSemantics() ) : Task

Connect to a peer, returning a new bus.

ConnectAsync ( IPAddress host, int port, ConnectionSemantics semantics = newConnectionSemantics() ) : Task

Connect to a peer, returning a new bus.

ConnectAsync ( IPAddress host, int port, System.TimeSpan timeout, CancellationToken token, ConnectionSemantics semantics = newConnectionSemantics() ) : Task

Connect to a peer, returning a new bus.

ConnectAsync ( IPAddress host, int port, System.TimeSpan timeout, ConnectionSemantics semantics = newConnectionSemantics() ) : Task

Connect to a peer, returning a new bus.

ConnectAsync ( IPAddress host, int port, int millisecondsTimeout, ConnectionSemantics semantics = newConnectionSemantics() ) : Task

Connect to a peer, returning a new bus.

ConnectAsync ( string host, int port, CancellationToken token, ConnectionSemantics semantics = newConnectionSemantics() ) : Task

Connect to a peer, returning a new bus.

ConnectAsync ( string host, int port, ConnectionSemantics semantics = newConnectionSemantics() ) : Task

Connect to a peer, returning a new bus.

ConnectAsync ( string host, int port, System.TimeSpan timeout, CancellationToken token, ConnectionSemantics semantics = newConnectionSemantics() ) : Task

Connect to a peer, returning a new bus.

ConnectAsync ( string host, int port, System.TimeSpan timeout, ConnectionSemantics semantics = newConnectionSemantics() ) : Task

Connect to a peer, returning a new bus.

ConnectAsync ( string host, int port, int millisecondsTimeout, ConnectionSemantics semantics = newConnectionSemantics() ) : Task

Connect to a peer, returning a new bus.

Disconnect ( ) : void

Disconnect from the peer

Dispose ( ) : void

Dispose of the client

Receive ( ) : WireContext

Receive a message from the network

ReceiveAsync ( ) : Task

Receive a message from the network

ReceiveAsync ( CancellationToken token ) : Task

Receive a message from the network

ReceiveAsync ( System.TimeSpan timeout ) : Task

Receive a message from the network

ReceiveAsync ( System.TimeSpan timeout, CancellationToken token ) : Task

Receive a message from the network

ReceiveAsync ( int timeoutMilliseconds ) : Task

Receive a message from the network

Send ( byte message ) : void

Send a message to the peer.

SendAsync ( byte message ) : Task

Send a message to the peer.

SendRequest ( byte message ) : WireContext

Send a message to the peer and wait for a reply

SendRequestAsync ( byte message ) : Task

Send a message to the peer and wait for a reply

Private Methods

Method Description
GetNextId ( ) : uint
InternalSendAsync ( byte message, uint id ) : Task
ReceiveMessages ( ) : void
SocketReceiveAsync ( Socket s, byte buffer, int start, int length ) : Task
WireBusClient ( Socket socket ) : System
WireBusClient ( Socket socket, ConnectionSemantics semantics ) : System

Method Details

Connect() public static method

Connect to a peer, returning a new bus.
public static Connect ( IPAddress host, int port, ConnectionSemantics semantics = newConnectionSemantics() ) : WireBusClient
host System.Net.IPAddress the target host
port int the target port
semantics ConnectionSemantics the semantics of the connection
return WireBusClient

Connect() public static method

Connect to a peer, returning a new bus.
public static Connect ( string host, int port, ConnectionSemantics semantics = newConnectionSemantics() ) : WireBusClient
host string the target host
port int the target port
semantics ConnectionSemantics the semantics of the connection
return WireBusClient

ConnectAsync() public static method

Connect to a peer, returning a new bus.
public static ConnectAsync ( IPAddress host, int port, CancellationToken token, ConnectionSemantics semantics = newConnectionSemantics() ) : Task
host System.Net.IPAddress the target host
port int the target port
token System.Threading.CancellationToken token used to cancel connection attempt
semantics ConnectionSemantics the semantics of the connection
return Task

ConnectAsync() public static method

Connect to a peer, returning a new bus.
public static ConnectAsync ( IPAddress host, int port, ConnectionSemantics semantics = newConnectionSemantics() ) : Task
host System.Net.IPAddress the target host
port int the target port
semantics ConnectionSemantics the semantics of the connection
return Task

ConnectAsync() public static method

Connect to a peer, returning a new bus.
public static ConnectAsync ( IPAddress host, int port, System.TimeSpan timeout, CancellationToken token, ConnectionSemantics semantics = newConnectionSemantics() ) : Task
host System.Net.IPAddress the target host
port int the target port
timeout System.TimeSpan the timeout after which to give up
token System.Threading.CancellationToken token used to cancel connection attempt
semantics ConnectionSemantics the semantics of the connection
return Task

ConnectAsync() public static method

Connect to a peer, returning a new bus.
public static ConnectAsync ( IPAddress host, int port, System.TimeSpan timeout, ConnectionSemantics semantics = newConnectionSemantics() ) : Task
host System.Net.IPAddress the target host
port int the target port
timeout System.TimeSpan the timeout after which to give up
semantics ConnectionSemantics the semantics of the connection
return Task

ConnectAsync() public static method

Connect to a peer, returning a new bus.
public static ConnectAsync ( IPAddress host, int port, int millisecondsTimeout, ConnectionSemantics semantics = newConnectionSemantics() ) : Task
host System.Net.IPAddress the target host
port int the target port
millisecondsTimeout int the timeout in milliseconds after which to give up
semantics ConnectionSemantics the semantics of the connection
return Task

ConnectAsync() public static method

Connect to a peer, returning a new bus.
public static ConnectAsync ( string host, int port, CancellationToken token, ConnectionSemantics semantics = newConnectionSemantics() ) : Task
host string the target host
port int the target port
token System.Threading.CancellationToken token used to cancel connection attempt
semantics ConnectionSemantics the semantics of the connection
return Task

ConnectAsync() public static method

Connect to a peer, returning a new bus.
public static ConnectAsync ( string host, int port, ConnectionSemantics semantics = newConnectionSemantics() ) : Task
host string the target host
port int the target port
semantics ConnectionSemantics the semantics of the connection
return Task

ConnectAsync() public static method

Connect to a peer, returning a new bus.
public static ConnectAsync ( string host, int port, System.TimeSpan timeout, CancellationToken token, ConnectionSemantics semantics = newConnectionSemantics() ) : Task
host string the target host
port int the target port
timeout System.TimeSpan the timeout after which to give up
token System.Threading.CancellationToken token used to cancel connection attempt
semantics ConnectionSemantics the semantics of the connection
return Task

ConnectAsync() public static method

Connect to a peer, returning a new bus.
public static ConnectAsync ( string host, int port, System.TimeSpan timeout, ConnectionSemantics semantics = newConnectionSemantics() ) : Task
host string the target host
port int the target port
timeout System.TimeSpan the timeout after which to give up
semantics ConnectionSemantics the semantics of the connection
return Task

ConnectAsync() public static method

Connect to a peer, returning a new bus.
public static ConnectAsync ( string host, int port, int millisecondsTimeout, ConnectionSemantics semantics = newConnectionSemantics() ) : Task
host string the target host
port int the target port
millisecondsTimeout int the timeout in milliseconds after which to give up
semantics ConnectionSemantics the semantics of the connection
return Task

Disconnect() public method

Disconnect from the peer
public Disconnect ( ) : void
return void

Dispose() public method

Dispose of the client
public Dispose ( ) : void
return void

Receive() public method

Receive a message from the network
public Receive ( ) : WireContext
return WireContext

ReceiveAsync() public method

Receive a message from the network
public ReceiveAsync ( ) : Task
return Task

ReceiveAsync() public method

Receive a message from the network
public ReceiveAsync ( CancellationToken token ) : Task
token System.Threading.CancellationToken
return Task

ReceiveAsync() public method

Receive a message from the network
public ReceiveAsync ( System.TimeSpan timeout ) : Task
timeout System.TimeSpan
return Task

ReceiveAsync() public method

Receive a message from the network
public ReceiveAsync ( System.TimeSpan timeout, CancellationToken token ) : Task
timeout System.TimeSpan
token System.Threading.CancellationToken
return Task

ReceiveAsync() public method

Receive a message from the network
public ReceiveAsync ( int timeoutMilliseconds ) : Task
timeoutMilliseconds int
return Task

Send() public method

Send a message to the peer.
public Send ( byte message ) : void
message byte the message to send
return void

SendAsync() public method

Send a message to the peer.
public SendAsync ( byte message ) : Task
message byte the message to send
return Task

SendRequest() public method

Send a message to the peer and wait for a reply
public SendRequest ( byte message ) : WireContext
message byte the message to send
return WireContext

SendRequestAsync() public method

Send a message to the peer and wait for a reply
public SendRequestAsync ( byte message ) : Task
message byte the message to send
return Task