Helper Class Reference  1.3
HomeGenie - Automation Programs' Engine API
Public Member Functions | Properties | List of all members
TcpClientHelper Class Reference

TCP client helper. Class instance accessor: TcpClient More...

Public Member Functions

TcpClientHelper Service (string address)
 Sets the server address to connect to. More...
 
bool Connect (int port)
 Connect to the server using the specified port. More...
 
TcpClientHelper Disconnect ()
 Disconnects from the remote host. More...
 
void SendMessage (string message)
 Sends a string message. More...
 
void SendMessage (byte[] message)
 Sends a raw data message. More...
 
TcpClientHelper OnStringReceived (Action< string > receivedAction)
 Sets the function to call when a new string message is received. More...
 
TcpClientHelper OnMessageReceived (Action< byte[]> receivedAction)
 Sets the function to call when a new raw message is received. More...
 
TcpClientHelper OnStatusChanged (Action< bool > statusChangeAction)
 Sets the function to call when the status of the connection changes. More...
 

Properties

bool IsConnected [get]
 Gets a value indicating whether the connection to the service is estabilished. More...
 
string EndOfLine [get, set]
 Gets or sets the end of line delimiter used in text messaging. More...
 

Detailed Description

TCP client helper. Class instance accessor: TcpClient

Member Function Documentation

◆ Service()

TcpClientHelper Service ( string  address)

Sets the server address to connect to.

Returns
TcpClientHelper.
Parameters
addressHost DNS or IP address.

◆ Connect()

bool Connect ( int  port)

Connect to the server using the specified port.

Parameters
portPort number.

◆ Disconnect()

TcpClientHelper Disconnect ( )

Disconnects from the remote host.

◆ SendMessage() [1/2]

void SendMessage ( string  message)

Sends a string message.

Parameters
messageMessage.

◆ SendMessage() [2/2]

void SendMessage ( byte[]  message)

Sends a raw data message.

Parameters
messageMessage.

◆ OnStringReceived()

TcpClientHelper OnStringReceived ( Action< string >  receivedAction)

Sets the function to call when a new string message is received.

Parameters
receivedActionFunction or inline delegate.

◆ OnMessageReceived()

TcpClientHelper OnMessageReceived ( Action< byte[]>  receivedAction)

Sets the function to call when a new raw message is received.

Parameters
receivedActionFunction or inline delegate.

◆ OnStatusChanged()

TcpClientHelper OnStatusChanged ( Action< bool >  statusChangeAction)

Sets the function to call when the status of the connection changes.

Parameters
statusChangeActionFunction or inline delegate.

Property Documentation

◆ IsConnected

bool IsConnected
get

Gets a value indicating whether the connection to the service is estabilished.

true if connected; otherwise, false.

◆ EndOfLine

string EndOfLine
getset

Gets or sets the end of line delimiter used in text messaging.

The end of line.


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