Shadow Network Framework  0.0.2-alpha
.NET Client Library for Shadow Network Framework
Loading...
Searching...
No Matches
SNFClient.Connection Class Reference

Objects of this class are what controls and handles Connections to the Host. More...

Public Member Functions

 Connection ()
 Create a new Connection Object.
 
Connection Connect ()
 Connects The instance to the target host.
 
Connection SetHost (string Host)
 Set's the connection host for this instance.
 
Connection SetPort (int Port)
 Sets the connection host's port for this instance.
 
Connection SetOnConnection (SimpleCB OnConnect)
 Sets The callbackto be called Upon Connection.
 
Connection SetOnSNFFail (SimpleCB OnSNFFail)
 Sets The callbackto be called Upon failure of the SNF Protocol.
 
Connection SetOnSocketFail (SocketExceptionCB OnSocketFail)
 Sets The callbackto be called Upon Socket Connection Failure.
 
Connection SetOnException (ExceptionCB OnException)
 Sets The callbackto be called Upon Any Exception that is not.
 
Connection SetOnTimeout (SimpleCB OnTimeout)
 Sets The callbackto be called Connection Timeout.
 
Connection AwaitConnection (TimeSpan timeout)
 Block Until the instance is Connected.
 
Connection AwaitConnection (int milisecondtimeout)
 Block Until the instance is Connected in Miliseconds.
 
void Send (Request r)
 Sends the request through the connection instance.
 

Static Public Member Functions

static Connection get ()
 Returns the Global Connection Instance.
 
static Connection Instantiate (string host, int Port)
 Instantiates a new Global Connection Instance.
 
static Connection Instantiate ()
 Instantiats a Global Connection instance.
 
static void SetDefaultHost (string host)
 Changes The Default Host URL.
 
static void SetDefaultPort (int port)
 Changes The Default Port.
 
static void InstanceSend (Request R)
 Send a Request through the Global Connection Instance.
 

Properties

static bool isInitialized [get]
 Returns if the Global Connection Instance ( See get ) is instatiated or not.
 
bool isConnected [get]
 Returns if the Instance is currently Connected.
 
string Host [get]
 Returns The Instance's Host URL.
 
int Port [get]
 Returns The instance's connection port.
 
ClientInfo ClientInfo [get]
 Returns ClientInfo of the Client.
 
bool isInstanceInitialized [get]
 Returns if the instance is initialized or not.
 

Detailed Description

Objects of this class are what controls and handles Connections to the Host.

Constructor & Destructor Documentation

◆ Connection()

SNFClient.Connection.Connection ( )

Create a new Connection Object.

Member Function Documentation

◆ get()

static Connection SNFClient.Connection.get ( )
static

Returns the Global Connection Instance.

Returns
The Global Connection | null if no instance was registred

◆ Instantiate() [1/2]

static Connection SNFClient.Connection.Instantiate ( string host,
int Port )
static

Instantiates a new Global Connection Instance.

Parameters
hostThe SNF host to Connect to
PortThe Port of the SNF host
Returns
The new Connection Instance
Exceptions
ClassUninitializedIf OPCode was not Initialized

◆ Instantiate() [2/2]

static Connection SNFClient.Connection.Instantiate ( )
static

Instantiats a Global Connection instance.

Note
If you want to instantiate a non Global Connection Instance use Instantiate(string, int)
Returns
The Global Connection Instance

◆ SetDefaultHost()

static void SNFClient.Connection.SetDefaultHost ( string host)
static

Changes The Default Host URL.

Parameters
hostNew Default SNF Host

◆ SetDefaultPort()

static void SNFClient.Connection.SetDefaultPort ( int port)
static

Changes The Default Port.

Parameters
portNew Default SNF Port

◆ InstanceSend()

static void SNFClient.Connection.InstanceSend ( Request R)
static

Send a Request through the Global Connection Instance.

Parameters
RRequest to send
Exceptions
ClassInstanceUninitializedIf The Global Connection Instance is not instantiated
See also
Instantiate()

◆ Connect()

Connection SNFClient.Connection.Connect ( )

Connects The instance to the target host.

Returns
Connection Instance

◆ SetHost()

Connection SNFClient.Connection.SetHost ( string Host)

Set's the connection host for this instance.

Parameters
HostThe new connection host
Returns
Connection Instance
Exceptions
Exceptions.Connection.AlreadyConnectedCannot Change this variable when the connection has already connected
See also
SetDefaultHost(string)

◆ SetPort()

Connection SNFClient.Connection.SetPort ( int Port)

Sets the connection host's port for this instance.

Parameters
PortThe new Conenction's Port
Returns
Connection Instance
Exceptions
Exceptions.Connection.AlreadyConnectedCannot Change this variable when the connection has already connected
See also
SetDefaultPort(int)

◆ SetOnConnection()

Connection SNFClient.Connection.SetOnConnection ( SimpleCB OnConnect)

Sets The callbackto be called Upon Connection.

Parameters
OnConnectCallback to called
Returns
Connection Instance
Exceptions
Exceptions.Connection.AlreadyConnectedCannot Change this variable when the connection has already connected

◆ SetOnSNFFail()

Connection SNFClient.Connection.SetOnSNFFail ( SimpleCB OnSNFFail)

Sets The callbackto be called Upon failure of the SNF Protocol.

Parameters
OnSNFFailCallback to called
Returns
Connection Instance
Exceptions
Exceptions.Connection.AlreadyConnectedCannot Change this variable when the connection has already connected

◆ SetOnSocketFail()

Connection SNFClient.Connection.SetOnSocketFail ( SocketExceptionCB OnSocketFail)

Sets The callbackto be called Upon Socket Connection Failure.

Parameters
OnSocketFailCallback to called
Returns
Connection Instance
Exceptions
Exceptions.Connection.AlreadyConnectedCannot Change this variable when the connection has already connected

◆ SetOnException()

Connection SNFClient.Connection.SetOnException ( ExceptionCB OnException)

Sets The callbackto be called Upon Any Exception that is not.

Parameters
OnExceptionCallback to called
Returns
Connection Instance
Exceptions
Exceptions.Connection.AlreadyConnectedCannot Change this variable when the connection has already connected

◆ SetOnTimeout()

Connection SNFClient.Connection.SetOnTimeout ( SimpleCB OnTimeout)

Sets The callbackto be called Connection Timeout.

Parameters
OnTimeoutCallback to called
Returns
Connection Instance
Exceptions
Exceptions.Connection.AlreadyConnectedCannot Change this variable when the connection has already connected

◆ AwaitConnection() [1/2]

Connection SNFClient.Connection.AwaitConnection ( TimeSpan timeout)

Block Until the instance is Connected.

Parameters
timeoutMaximum Allowed Timeout
Returns
Connection Instance
Exceptions
InstanceUninitializedInstance was not Initialized
Exceptions.Connection.NotConnectingInstance was not connecting, Call this after Connect

◆ AwaitConnection() [2/2]

Connection SNFClient.Connection.AwaitConnection ( int milisecondtimeout)

Block Until the instance is Connected in Miliseconds.

Parameters
milisecondtimeoutMaximum Allowed Timeout in Miliseconds
Returns
Connection Instance
Exceptions
InstanceUninitializedInstance was not Initialized
Exceptions.Connection.NotConnectingInstance was not connecting, Call this after Connect

◆ Send()

void SNFClient.Connection.Send ( Request r)

Sends the request through the connection instance.

Parameters
rRequest to be sent
Exceptions
InstanceUninitializedInstance was not initialized
Exceptions.Connection.NotConnectedInstance was not connected

Property Documentation

◆ isInitialized

bool SNFClient.Connection.isInitialized
staticget

Returns if the Global Connection Instance ( See get ) is instatiated or not.

See also
Instantiate()

◆ isConnected

bool SNFClient.Connection.isConnected
get

Returns if the Instance is currently Connected.

◆ Host

string SNFClient.Connection.Host
get

Returns The Instance's Host URL.

◆ Port

int SNFClient.Connection.Port
get

Returns The instance's connection port.

◆ ClientInfo

ClientInfo SNFClient.Connection.ClientInfo
get

Returns ClientInfo of the Client.

See also
ClientInfo

◆ isInstanceInitialized

bool SNFClient.Connection.isInstanceInitialized
get

Returns if the instance is initialized or not.

Note
If instance is not Initialized, then instanciate a new one, as by default Any instantiated Connection object is initialized if no problem occured.

The documentation for this class was generated from the following file: