C# 클래스 GSF.Communication.ClientBase

Base class for a client involved in server-client communication.
상속: System.ComponentModel.Component, IClient, ISupportInitialize, IPersistSettings
파일 보기 프로젝트 열기: GridProtectionAlliance/gsf 1 사용 예제들

Private Properties

프로퍼티 타입 설명
ReConnect void

공개 메소드들

메소드 설명
BeginInit ( ) : void

Performs necessary operations before the client properties are initialized.

BeginInit() should never be called by user-code directly. This method exists solely for use by the designer if the server is consumed through the designer surface of the IDE.

Connect ( ) : void

Connects the client to the server synchronously.

ConnectAsync ( ) : WaitHandle

Connects the client to the server asynchronously.

Derived classes are expected to override this method with protocol specific connection operations. Call the base class method to obtain an operational wait handle if protocol connection operation doesn't provide one already.

Create ( string connectionString ) : IClient

Create a communications client

Note that typical connection string should be prefixed with a "protocol=tcp", "protocol=udp", "protocol=serial" or "protocol=file"

Disconnect ( ) : void

When overridden in a derived class, disconnects client from the server synchronously.

EndInit ( ) : void

Performs necessary operations after the client properties are initialized.

EndInit() should never be called by user-code directly. This method exists solely for use by the designer if the server is consumed through the designer surface of the IDE.

Initialize ( ) : void

Initializes the client.

Initialize() is to be called by user-code directly only if the client is not consumed through the designer surface of the IDE.

LoadSettings ( ) : void

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

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

When overridden in a derived class, 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 ReceiveData event handler. Calling this method outside this event will have unexpected results.

SaveSettings ( ) : void

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

Send ( byte data ) : void

Sends data to the server synchronously.

Send ( byte data, int offset, int length ) : void

Sends data to the server synchronously.

Send ( object serializableObject ) : void

Sends data to the server synchronously.

Send ( string data ) : void

Sends data to the server synchronously.

SendAsync ( byte data ) : WaitHandle

Sends data to the server asynchronously.

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

Sends data to the server asynchronously.

SendAsync ( object serializableObject ) : WaitHandle

Sends data to the server asynchronously.

SendAsync ( string data ) : WaitHandle

Sends data to the server asynchronously.

보호된 메소드들

메소드 설명
ClientBase ( ) : System

Initializes a new instance of the client.

ClientBase ( TransportProtocol transportProtocol, string connectionString ) : System

Initializes a new instance of the client.

Dispose ( bool disposing ) : void

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

OnConnectionAttempt ( ) : void

Raises the ConnectionAttempt event.

OnConnectionEstablished ( ) : void

Raises the ConnectionEstablished event.

OnConnectionException ( Exception ex ) : void

Raises the ConnectionException event.

OnConnectionTerminated ( ) : void

Raises the ConnectionTerminated event.

OnReceiveData ( int size ) : void

Raises the ReceiveData event.

This event is automatically raised by call to OnReceiveDataComplete so that inheritors never need to worry about raising this event. This method is only included here in case any custom client implementations need to explicitly raise this event.

OnReceiveDataComplete ( byte data, int size ) : void

Raises the ReceiveDataComplete event.

OnReceiveDataException ( Exception ex ) : void

Raises the ReceiveDataException event.

OnSendDataComplete ( ) : void

Raises the SendDataComplete event.

OnSendDataException ( Exception ex ) : void

Raises the SendDataException event.

OnSendDataStart ( ) : void

Raises the SendDataStart event.

OnUnhandledUserException ( Exception ex ) : void

Raises the UnhandledUserException event.

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

When overridden in a derived class, sends data to the server asynchronously.

UpdateBytesReceived ( int bytes ) : void

Updates the Statistics pertaining to bytes received.

UpdateBytesSent ( int bytes ) : void

Updates the Statistics pertaining to bytes sent.

ValidateConnectionString ( string connectionString ) : void

When overridden in a derived class, validates the specified connectionString.

비공개 메소드들

메소드 설명
ReConnect ( ) : void

Re-connects the client if currently connected.

메소드 상세

BeginInit() 공개 메소드

Performs necessary operations before the client properties are initialized.
BeginInit() should never be called by user-code directly. This method exists solely for use by the designer if the server is consumed through the designer surface of the IDE.
public BeginInit ( ) : void
리턴 void

ClientBase() 보호된 메소드

Initializes a new instance of the client.
protected ClientBase ( ) : System
리턴 System

ClientBase() 보호된 메소드

Initializes a new instance of the client.
protected ClientBase ( TransportProtocol transportProtocol, string connectionString ) : System
transportProtocol TransportProtocol One of the values.
connectionString string The data used by the client for connection to a server.
리턴 System

Connect() 공개 메소드

Connects the client to the server synchronously.
public Connect ( ) : void
리턴 void

ConnectAsync() 공개 메소드

Connects the client to the server asynchronously.
Derived classes are expected to override this method with protocol specific connection operations. Call the base class method to obtain an operational wait handle if protocol connection operation doesn't provide one already.
Server property in is invalid. Attempt is made to connect the client when it is not disconnected.
public ConnectAsync ( ) : WaitHandle
리턴 System.Threading.WaitHandle

Create() 공개 정적인 메소드

Create a communications client
Note that typical connection string should be prefixed with a "protocol=tcp", "protocol=udp", "protocol=serial" or "protocol=file"
public static Create ( string connectionString ) : IClient
connectionString string Connection string for the client.
리턴 IClient

Disconnect() 공개 메소드

When overridden in a derived class, disconnects client from the server synchronously.
public Disconnect ( ) : void
리턴 void

Dispose() 보호된 메소드

Releases the unmanaged resources used by the client 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.
리턴 void

EndInit() 공개 메소드

Performs necessary operations after the client properties are initialized.
EndInit() should never be called by user-code directly. This method exists solely for use by the designer if the server is consumed through the designer surface of the IDE.
public EndInit ( ) : void
리턴 void

Initialize() 공개 메소드

Initializes the client.
Initialize() is to be called by user-code directly only if the client is not consumed through the designer surface of the IDE.
public Initialize ( ) : void
리턴 void

LoadSettings() 공개 메소드

Loads saved client settings from the config file if the PersistSettings property is set to true.
has a value of null or empty string.
public LoadSettings ( ) : void
리턴 void

OnConnectionAttempt() 보호된 메소드

Raises the ConnectionAttempt event.
protected OnConnectionAttempt ( ) : void
리턴 void

OnConnectionEstablished() 보호된 메소드

Raises the ConnectionEstablished event.
protected OnConnectionEstablished ( ) : void
리턴 void

OnConnectionException() 보호된 메소드

Raises the ConnectionException event.
protected OnConnectionException ( Exception ex ) : void
ex System.Exception Exception to send to event.
리턴 void

OnConnectionTerminated() 보호된 메소드

Raises the ConnectionTerminated event.
protected OnConnectionTerminated ( ) : void
리턴 void

OnReceiveData() 보호된 메소드

Raises the ReceiveData event.
This event is automatically raised by call to OnReceiveDataComplete so that inheritors never need to worry about raising this event. This method is only included here in case any custom client implementations need to explicitly raise this event.
protected OnReceiveData ( int size ) : void
size int Number of bytes received from the client.
리턴 void

OnReceiveDataComplete() 보호된 메소드

Raises the ReceiveDataComplete event.
protected OnReceiveDataComplete ( byte data, int size ) : void
data byte Data received from the client.
size int Number of bytes received from the client.
리턴 void

OnReceiveDataException() 보호된 메소드

Raises the ReceiveDataException event.
protected OnReceiveDataException ( Exception ex ) : void
ex System.Exception Exception to send to event.
리턴 void

OnSendDataComplete() 보호된 메소드

Raises the SendDataComplete event.
protected OnSendDataComplete ( ) : void
리턴 void

OnSendDataException() 보호된 메소드

Raises the SendDataException event.
protected OnSendDataException ( Exception ex ) : void
ex System.Exception Exception to send to event.
리턴 void

OnSendDataStart() 보호된 메소드

Raises the SendDataStart event.
protected OnSendDataStart ( ) : void
리턴 void

OnUnhandledUserException() 보호된 메소드

Raises the UnhandledUserException event.
protected OnUnhandledUserException ( Exception ex ) : void
ex System.Exception Exception to send to event.
리턴 void

Read() 공개 추상적인 메소드

When overridden in a derived class, 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 ReceiveData event handler. Calling this method outside this event will have unexpected results.
public abstract 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 .
리턴 int

SaveSettings() 공개 메소드

Saves client settings to the config file if the PersistSettings property is set to true.
has a value of null or empty string.
public SaveSettings ( ) : void
리턴 void

Send() 공개 메소드

Sends data to the server synchronously.
public Send ( byte data ) : void
data byte The binary data that is to be sent.
리턴 void

Send() 공개 메소드

Sends data to the server synchronously.
public Send ( byte data, int offset, int length ) : void
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 .
리턴 void

Send() 공개 메소드

Sends data to the server synchronously.
public Send ( object serializableObject ) : void
serializableObject object The serializable object that is to be sent.
리턴 void

Send() 공개 메소드

Sends data to the server synchronously.
public Send ( string data ) : void
data string The plain-text data that is to be sent.
리턴 void

SendAsync() 공개 메소드

Sends data to the server asynchronously.
public SendAsync ( byte data ) : WaitHandle
data byte The binary data that is to be sent.
리턴 System.Threading.WaitHandle

SendAsync() 공개 메소드

Sends data to the server asynchronously.
public SendAsync ( 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 .
리턴 System.Threading.WaitHandle

SendAsync() 공개 메소드

Sends data to the server asynchronously.
public SendAsync ( object serializableObject ) : WaitHandle
serializableObject object The serializable object that is to be sent.
리턴 System.Threading.WaitHandle

SendAsync() 공개 메소드

Sends data to the server asynchronously.
public SendAsync ( string data ) : WaitHandle
data string The plain-text data that is to be sent.
리턴 System.Threading.WaitHandle

SendDataAsync() 보호된 추상적인 메소드

When overridden in a derived class, sends data to the server asynchronously.
protected abstract 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 .
리턴 System.Threading.WaitHandle

UpdateBytesReceived() 보호된 메소드

Updates the Statistics pertaining to bytes received.
protected UpdateBytesReceived ( int bytes ) : void
bytes int
리턴 void

UpdateBytesSent() 보호된 메소드

Updates the Statistics pertaining to bytes sent.
protected UpdateBytesSent ( int bytes ) : void
bytes int
리턴 void

ValidateConnectionString() 보호된 추상적인 메소드

When overridden in a derived class, validates the specified connectionString.
protected abstract ValidateConnectionString ( string connectionString ) : void
connectionString string The connection string to be validated.
리턴 void