Table of Contents

Interface INetworkTransport

Namespace
VAST.Transport
Assembly
VAST.Common.dll

Defines the contract for a network transport that supports both server and client communication.

public interface INetworkTransport

Properties

ConnectionCount

Gets the number of currently active connections.

int ConnectionCount { get; }

Property Value

int

InstanceId

Gets the unique identifier for this transport instance.

Guid InstanceId { get; }

Property Value

Guid

Methods

Connect(IPEndPoint, ProtocolType)

Connects to the specified endpoint using the specified protocol.

bool Connect(IPEndPoint endPoint, ProtocolType protocolType)

Parameters

endPoint IPEndPoint

The remote endpoint to connect to.

protocolType ProtocolType

The protocol type to use for the connection.

Returns

bool

true if the connection was initiated successfully; otherwise, false.

Connect(ConnectionParameters)

Connects using the specified connection parameters.

bool Connect(ConnectionParameters pars)

Parameters

pars ConnectionParameters

The connection parameters.

Returns

bool

true if the connection was initiated successfully; otherwise, false.

Disconnect(IPProtoEndPoint)

Disconnects the specified endpoint.

void Disconnect(IPProtoEndPoint endPoint)

Parameters

endPoint IPProtoEndPoint

The endpoint to disconnect.

GetStatistics(IPProtoEndPoint)

Gets the connection statistics for the specified endpoint.

TransportStat GetStatistics(IPProtoEndPoint endPoint)

Parameters

endPoint IPProtoEndPoint

The endpoint to get statistics for.

Returns

TransportStat

The transport statistics, or null if the endpoint is not found.

Send(IPProtoEndPoint, VersatileBuffer)

Sends data to the specified endpoint.

SendResult Send(IPProtoEndPoint endPoint, VersatileBuffer packet)

Parameters

endPoint IPProtoEndPoint

The endpoint to send data to.

packet VersatileBuffer

The data buffer to send.

Returns

SendResult

The result of the send operation.

Exceptions

Exception

Thrown when the endpoint is not found in the active connections.

Send(IPProtoEndPoint, IPProtoEndPoint, VersatileBuffer)

Sends data from a local endpoint to a remote endpoint.

SendResult Send(IPProtoEndPoint localEndPoint, IPProtoEndPoint remoteEndPoint, VersatileBuffer packet)

Parameters

localEndPoint IPProtoEndPoint

The local endpoint to send data from.

remoteEndPoint IPProtoEndPoint

The remote endpoint to send data to.

packet VersatileBuffer

The data buffer to send.

Returns

SendResult

The result of the send operation.

Remarks

This method is primarily intended for UDP connections where the local endpoint matters.

Exceptions

Exception

Thrown when the local endpoint is not found in the active connections.

Start()

Starts the transport, enabling it to accept connections and process data.

void Start()

StartListen(IPEndPoint, ProtocolType)

Starts listening for incoming connections on the specified endpoint.

void StartListen(IPEndPoint serverEndPoint, ProtocolType protocolType)

Parameters

serverEndPoint IPEndPoint

The server endpoint to listen on.

protocolType ProtocolType

The protocol type to use (TCP or UDP).

StartListen(ConnectionParameters)

Starts listening for incoming connections using the specified parameters.

void StartListen(ConnectionParameters pars)

Parameters

pars ConnectionParameters

The connection parameters including the endpoint configuration.

Stop()

Stops the transport and closes all active connections.

void Stop()

StopListen(IPProtoEndPoint)

Stops listening on the specified endpoint.

void StopListen(IPProtoEndPoint serverEndPoint)

Parameters

serverEndPoint IPProtoEndPoint

The endpoint to stop listening on.

Update(IPProtoEndPoint, ConnectionParameters)

Updates connection parameters for an existing connection.

void Update(IPProtoEndPoint endPoint, ConnectionParameters pars)

Parameters

endPoint IPProtoEndPoint

The endpoint to update parameters for.

pars ConnectionParameters

The new connection parameters.

Remarks

Only parameters that can be changed after a connection is established will be updated.

Events

Connected

Occurs when a new client connects or a listener starts successfully.

event EventHandler<TransportArgs> Connected

Event Type

EventHandler<TransportArgs>

Disconnected

Occurs when a connected client disconnects or a connection is closed.

event EventHandler<TransportArgs> Disconnected

Event Type

EventHandler<TransportArgs>

Received

Occurs when new data is received from a connection.

event EventHandler<TransportArgs> Received

Event Type

EventHandler<TransportArgs>

Sent

Occurs when data has been sent successfully.

event EventHandler<TransportArgs> Sent

Event Type

EventHandler<TransportArgs>