C# Class NetworkCommsDotNet.Connections.Connection

Exibir arquivo Open project: MarcFletcher/NetworkComms.Net Class Usage Examples

Protected Properties

Property Type Description
asyncListenStarted bool
asyncListenerInRead bool
connectionEstablishWait System.Threading.ManualResetEvent
connectionSetupException bool
connectionSetupExceptionStr string
connectionSetupWait System.Threading.ManualResetEvent
incomingDataListenThread Thread
packetBuilder NetworkCommsDotNet.Tools.PacketBuilder
totalBytesRead int

Public Methods

Method Description
EstablishConnection ( ) : void

Establish this connection

ToString ( ) : string

Returns ConnectionInfo.ToString

Protected Methods

Method Description
Connection ( ConnectionInfo connectionInfo, SendReceiveOptions defaultSendReceiveOptions ) : System

Create a new connection object

ConnectionHandshake ( ) : void

Performs a connection handshake with the remote end of the connection. Exchanges network identifier and any listener whose IPAddress matches the connection localEndPoint IPAddress.

EstablishConnectionSpecific ( ) : void

Any connection type specific establish tasks. Should call at least ConnectionHandshake() or TriggerConnectionEstablishDelegates();

IncomingPacketHandleHandOff ( PacketBuilder packetBuilder ) : void

Attempts to use the data provided in packetBuilder to recreate something useful. If we don't have enough data yet that value is set in packetBuilder.

StartIncomingDataListen ( ) : void

A connection specific method which triggers any requisites for accepting incoming data

TriggerConnectionEstablishDelegates ( ) : void

Trigger connection establish delegates.

WaitForConnectionEstablish ( int waitTimeoutMS ) : bool

Return true if the connection is established within the provided timeout, otherwise false

Private Methods

Method Description
CheckSumFailResendHandler ( MemoryStream packetDataSection ) : void

Handle an incoming CheckSumFailResend packet type

ConnectionSetupHandler ( MemoryStream packetDataSection ) : void

Handle an incoming ConnectionSetup packet type

ConnectionSetupHandlerFinal ( ConnectionInfo remoteConnectionInfo, bool &possibleClashWithExistingConnection, Connection &existingConnection ) : bool

Attempts to complete the connection establish with a minimum of locking to avoid possible deadlocking

Method Details

Connection() protected method

Create a new connection object
protected Connection ( ConnectionInfo connectionInfo, SendReceiveOptions defaultSendReceiveOptions ) : System
connectionInfo ConnectionInfo ConnectionInfo corresponding to the new connection
defaultSendReceiveOptions SendReceiveOptions The SendReceiveOptions which should be used as connection defaults
return System

ConnectionHandshake() protected method

Performs a connection handshake with the remote end of the connection. Exchanges network identifier and any listener whose IPAddress matches the connection localEndPoint IPAddress.
protected ConnectionHandshake ( ) : void
return void

EstablishConnection() public method

Establish this connection
public EstablishConnection ( ) : void
return void

EstablishConnectionSpecific() protected abstract method

Any connection type specific establish tasks. Should call at least ConnectionHandshake() or TriggerConnectionEstablishDelegates();
protected abstract EstablishConnectionSpecific ( ) : void
return void

IncomingPacketHandleHandOff() protected method

Attempts to use the data provided in packetBuilder to recreate something useful. If we don't have enough data yet that value is set in packetBuilder.
protected IncomingPacketHandleHandOff ( PacketBuilder packetBuilder ) : void
packetBuilder NetworkCommsDotNet.Tools.PacketBuilder The containing incoming cached data
return void

StartIncomingDataListen() protected abstract method

A connection specific method which triggers any requisites for accepting incoming data
protected abstract StartIncomingDataListen ( ) : void
return void

ToString() public method

Returns ConnectionInfo.ToString
public ToString ( ) : string
return string

TriggerConnectionEstablishDelegates() protected method

Trigger connection establish delegates.
protected TriggerConnectionEstablishDelegates ( ) : void
return void

WaitForConnectionEstablish() protected method

Return true if the connection is established within the provided timeout, otherwise false
protected WaitForConnectionEstablish ( int waitTimeoutMS ) : bool
waitTimeoutMS int Wait time in milliseconds before returning
return bool

Property Details

asyncListenStarted protected_oe property

True if async listen has started
protected bool asyncListenStarted
return bool

asyncListenerInRead protected_oe property

True if the async listen method is in a beginRead
protected bool asyncListenerInRead
return bool

connectionEstablishWait protected_oe property

A manual reset event which can be used to handle connection setup and establish.
protected ManualResetEvent,System.Threading connectionEstablishWait
return System.Threading.ManualResetEvent

connectionSetupException protected_oe property

A boolean used to signal a connection setup exception.
protected bool connectionSetupException
return bool

connectionSetupExceptionStr protected_oe property

If connectionSetupException is true provides additional exception information.
protected string connectionSetupExceptionStr
return string

connectionSetupWait protected_oe property

A manual reset event which can be used to handle connection setup and establish.
protected ManualResetEvent,System.Threading connectionSetupWait
return System.Threading.ManualResetEvent

incomingDataListenThread protected_oe property

The thread listening for incoming data should we be using synchronous methods.
protected Thread incomingDataListenThread
return Thread

packetBuilder protected_oe property

The PacketBuilder for this connection
protected PacketBuilder,NetworkCommsDotNet.Tools packetBuilder
return NetworkCommsDotNet.Tools.PacketBuilder

totalBytesRead protected_oe property

The total bytes read so far within dataBuffer
protected int totalBytesRead
return int