C# Class GSF.Communication.ZeroMQClient

Represents a ZeroMQ DEALER style socket as a communication client.
Inheritance: ClientBase
Afficher le fichier Open project: GridProtectionAlliance/gsf Class Usage Examples

Private Properties

Свойство Type Description
OpenSocket void
ReceiveDataHandler void

Méthodes publiques

Méthode Description
ConnectAsync ( ) : WaitHandle

Connects the ZeroMQClient to the server asynchronously.

Disconnect ( ) : void

Disconnects the ZeroMQClient from the connected server synchronously.

LoadSettings ( ) : void

Loads saved TcpClient settings from the config file if the ClientBase.PersistSettings property is set to true.

Read ( byte buffer, int startIndex, int length ) : int

Reads a number of bytes from the current received data buffer and writes those bytes into a byte array at the specified offset.

This function should only be called from within the ClientBase.ReceiveData event handler. Calling this method outside this event will have unexpected results.

SaveSettings ( ) : void

Saves TcpClient settings to the config file if the ClientBase.PersistSettings property is set to true.

ZeroMQClient ( ) : System

Initializes a new instance of the ZeroMQClient class.

ZeroMQClient ( IContainer container ) : System

Initializes a new instance of the ZeroMQClient class.

ZeroMQClient ( string connectString ) : System

Initializes a new instance of the ZeroMQClient class.

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the ZeroMQClient and optionally releases the managed resources.

OnConnectionException ( Exception ex ) : void

Raises the ClientBase.ConnectionException event.

OnDisconnectException ( Exception ex ) : void

Raises the ClientBase.SendDataException event for disconnect exceptions.

OnReceiveDataException ( Exception ex ) : void

Raises the ClientBase.ReceiveDataException event.

OnSendDataException ( Exception ex ) : void

Raises the ClientBase.SendDataException event.

OnUnhandledUserException ( Exception ex ) : void

Raises the ClientBase.UnhandledUserException event.

SendDataAsync ( byte data, int offset, int length ) : WaitHandle

Sends data to the server asynchronously.

ValidateConnectionString ( string connectionString ) : void

Validates the specified connectionString.

Private Methods

Méthode Description
OpenSocket ( object state ) : void
ReceiveDataHandler ( ) : void

Method Details

ConnectAsync() public méthode

Connects the ZeroMQClient to the server asynchronously.
Attempt is made to connect the when it is not disconnected.
public ConnectAsync ( ) : WaitHandle
Résultat System.Threading.WaitHandle

Disconnect() public méthode

Disconnects the ZeroMQClient from the connected server synchronously.
public Disconnect ( ) : void
Résultat void

Dispose() protected méthode

Releases the unmanaged resources used by the ZeroMQClient and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
Résultat void

LoadSettings() public méthode

Loads saved TcpClient settings from the config file if the ClientBase.PersistSettings property is set to true.
public LoadSettings ( ) : void
Résultat void

OnConnectionException() protected méthode

Raises the ClientBase.ConnectionException event.
protected OnConnectionException ( Exception ex ) : void
ex System.Exception Exception to send to event.
Résultat void

OnDisconnectException() protected méthode

Raises the ClientBase.SendDataException event for disconnect exceptions.
protected OnDisconnectException ( Exception ex ) : void
ex System.Exception Disconnect exception to send to event.
Résultat void

OnReceiveDataException() protected méthode

Raises the ClientBase.ReceiveDataException event.
protected OnReceiveDataException ( Exception ex ) : void
ex System.Exception Exception to send to event.
Résultat void

OnSendDataException() protected méthode

Raises the ClientBase.SendDataException event.
protected OnSendDataException ( Exception ex ) : void
ex System.Exception Exception to send to event.
Résultat void

OnUnhandledUserException() protected méthode

Raises the ClientBase.UnhandledUserException event.
protected OnUnhandledUserException ( Exception ex ) : void
ex System.Exception Exception to send to event.
Résultat void

Read() public méthode

Reads a number of bytes from the current received data buffer and writes those bytes into a byte array at the specified offset.
This function should only be called from within the ClientBase.ReceiveData event handler. Calling this method outside this event will have unexpected results.
No received data buffer has been defined to read. is null. /// or is less than 0 -or- /// and will exceed length. ///
public Read ( byte buffer, int startIndex, int length ) : int
buffer byte Destination buffer used to hold copied bytes.
startIndex int 0-based starting index into destination to begin writing data.
length int The number of bytes to read from current received data buffer and write into .
Résultat int

SaveSettings() public méthode

Saves TcpClient settings to the config file if the ClientBase.PersistSettings property is set to true.
public SaveSettings ( ) : void
Résultat void

SendDataAsync() protected méthode

Sends data to the server asynchronously.
protected SendDataAsync ( byte data, int offset, int length ) : WaitHandle
data byte The buffer that contains the binary data to be sent.
offset int The zero-based position in the at which to begin sending data.
length int The number of bytes to be sent from starting at the .
Résultat System.Threading.WaitHandle

ValidateConnectionString() protected méthode

Validates the specified connectionString.
Server property is missing. Server property is invalid. Server port value is not between and .
protected ValidateConnectionString ( string connectionString ) : void
connectionString string Connection string to be validated.
Résultat void

ZeroMQClient() public méthode

Initializes a new instance of the ZeroMQClient class.
public ZeroMQClient ( ) : System
Résultat System

ZeroMQClient() public méthode

Initializes a new instance of the ZeroMQClient class.
public ZeroMQClient ( IContainer container ) : System
container IContainer object that contains the .
Résultat System

ZeroMQClient() public méthode

Initializes a new instance of the ZeroMQClient class.
public ZeroMQClient ( string connectString ) : System
connectString string Connect string of the . See for format.
Résultat System