Show / Hide Table of Contents

Class NetworkMessenger

Send and receive messages over a network connection.

Inheritance
object
NetworkMessenger
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: HoloMetrix.Net.Remote
Assembly: HoloMetrix.Net.Remote.dll
Syntax
public class NetworkMessenger

Constructors

| Improve this Doc View Source

NetworkMessenger(NetworkStream)

Initializes a new instance of the NetworkMessenger class.

Declaration
public NetworkMessenger(NetworkStream stream)
Parameters
Type Name Description
NetworkStream stream

The network stream.

Properties

| Improve this Doc View Source

Stream

Currently connected client.

Declaration
public NetworkStream Stream { get; }
Property Value
Type Description
NetworkStream

Methods

| Improve this Doc View Source

SendMessage(string, byte[], bool, int)

Send a message to the client.

Declaration
public Response SendMessage(string command, byte[] data = null, bool waitForResponse = false, int waitForMilliseconds = 0)
Parameters
Type Name Description
string command

The command message.

byte[] data

Optional data package.

bool waitForResponse

Whether or not to await a response.

int waitForMilliseconds

The timeout in milliseconds.

Returns
Type Description
Response
| Improve this Doc View Source

SendMessageAsync(string, byte[], bool, int)

Send a message to the client.

Declaration
public Task<Response> SendMessageAsync(string command, byte[] data = null, bool waitForResponse = false, int waitForMilliseconds = 0)
Parameters
Type Name Description
string command

The command message.

byte[] data

Optional data package.

bool waitForResponse

Whether or not to await a response.

int waitForMilliseconds

The timeout in milliseconds.

Returns
Type Description
Task<Response>

The message response.

Events

| Improve this Doc View Source

ConnectionLost

Event raised when the NetworkMessenger is closed.

Declaration
public event EventHandler ConnectionLost
Event Type
Type Description
EventHandler
| Improve this Doc View Source

MessageReceived

Event raised when a new message is received.

Declaration
public event MessageReceivedEventHandler MessageReceived
Event Type
Type Description
MessageReceivedEventHandler
  • Improve this Doc
  • View Source
Back to top Generated by DocFX