C# 클래스 GSF.Communication.ServerBase

상속: System.ComponentModel.Component, IServer, ISupportInitialize, IPersistSettings
파일 보기 프로젝트 열기: GridProtectionAlliance/gsf 1 사용 예제들

Private Properties

프로퍼티 타입 설명
BeginInit void
EndInit void

공개 메소드들

메소드 설명
Create ( string configurationString ) : IServer

Create a communications server

Note that typical configuration string should be prefixed with a "protocol=tcp" or a "protocol=udp"

DisconnectAll ( ) : void

Disconnects all of the connected clients.

DisconnectOne ( System.Guid clientID ) : void

When overridden in a derived class, disconnects a connected client.

Initialize ( ) : void

Initializes the server.

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

IsClientConnected ( System.Guid clientID ) : bool

Determines whether the given client is currently connected to the server.

LoadSettings ( ) : void

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

Multicast ( byte data ) : void

Sends data to all of the connected clients synchronously.

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

Sends data to all of the connected clients synchronously.

Multicast ( object serializableObject ) : void

Sends data to all of the connected clients synchronously.

Multicast ( string data ) : void

Sends data to all of the connected clients synchronously.

MulticastAsync ( byte data ) : WaitHandle[]

Sends data to all of the connected clients asynchronously.

MulticastAsync ( byte data, int offset, int length ) : WaitHandle[]

Sends data to all of the connected clients asynchronously.

MulticastAsync ( object serializableObject ) : WaitHandle[]

Sends data to all of the connected clients asynchronously.

MulticastAsync ( string data ) : WaitHandle[]

Sends data to all of the connected clients asynchronously.

Read ( Guid clientID, 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 ReceiveClientData event handler. Calling this method outside this event will have unexpected results.

SaveSettings ( ) : void

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

SendTo ( Guid clientID, byte data ) : void

Sends data to the specified client synchronously.

SendTo ( Guid clientID, byte data, int offset, int length ) : void

Sends data to the specified client synchronously.

SendTo ( Guid clientID, object serializableObject ) : void

Sends data to the specified client synchronously.

SendTo ( Guid clientID, string data ) : void

Sends data to the specified client synchronously.

SendToAsync ( Guid clientID, byte data ) : WaitHandle

Sends data to the specified client asynchronously.

SendToAsync ( Guid clientID, byte data, int offset, int length ) : WaitHandle

Sends data to the specified client asynchronously.

SendToAsync ( Guid clientID, object serializableObject ) : WaitHandle

Sends data to the specified client asynchronously.

SendToAsync ( Guid clientID, string data ) : WaitHandle

Sends data to the specified client asynchronously.

Start ( ) : void

When overridden in a derived class, starts the server.

Stop ( ) : void

When overridden in a derived class, stops the server.

보호된 메소드들

메소드 설명
Dispose ( bool disposing ) : void

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

OnClientConnected ( Guid clientID ) : void

Raises the ClientConnected event.

OnClientConnectingException ( Exception ex ) : void

Raises the ClientConnectingException event.

OnClientDisconnected ( Guid clientID ) : void

Raises the ClientDisconnected event.

OnReceiveClientData ( Guid clientID, int size ) : void

Raises the ReceiveClientData event.

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

OnReceiveClientDataComplete ( Guid clientID, byte data, int size ) : void

Raises the ReceiveClientDataComplete event.

OnReceiveClientDataException ( Guid clientID, Exception ex ) : void

Raises the ReceiveClientDataException event.

OnSendClientDataComplete ( Guid clientID ) : void

Raises the SendClientDataComplete event.

OnSendClientDataException ( Guid clientID, Exception ex ) : void

Raises the SendClientDataException event.

OnSendClientDataStart ( Guid clientID ) : void

Raises the SendClientDataStart event.

OnServerStarted ( ) : void

Raises the ServerStarted event.

OnServerStopped ( ) : void

Raises the ServerStopped event.

OnUnhandledUserException ( Exception ex ) : void

Raises the UnhandledUserException event.

ReStart ( ) : void

Re-starts the server if currently running.

SendDataToAsync ( Guid clientID, byte data, int offset, int length ) : WaitHandle

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

ServerBase ( ) : System

Initializes a new instance of the server.

ServerBase ( TransportProtocol transportProtocol, string configurationString ) : System

Initializes a new instance of the server.

ValidateConfigurationString ( string configurationString ) : void

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

비공개 메소드들

메소드 설명
BeginInit ( ) : void
EndInit ( ) : void

메소드 상세

Create() 공개 정적인 메소드

Create a communications server
Note that typical configuration string should be prefixed with a "protocol=tcp" or a "protocol=udp"
public static Create ( string configurationString ) : IServer
configurationString string The configuration string for the server.
리턴 IServer

DisconnectAll() 공개 메소드

Disconnects all of the connected clients.
public DisconnectAll ( ) : void
리턴 void

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

When overridden in a derived class, disconnects a connected client.
public abstract DisconnectOne ( System.Guid clientID ) : void
clientID System.Guid ID of the client to be disconnected.
리턴 void

Dispose() 보호된 메소드

Releases the unmanaged resources used by the server 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

Initialize() 공개 메소드

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

IsClientConnected() 공개 메소드

Determines whether the given client is currently connected to the server.
public IsClientConnected ( System.Guid clientID ) : bool
clientID System.Guid The ID of the client.
리턴 bool

LoadSettings() 공개 메소드

Loads saved server 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

Multicast() 공개 메소드

Sends data to all of the connected clients synchronously.
public Multicast ( byte data ) : void
data byte The binary data that is to be sent.
리턴 void

Multicast() 공개 메소드

Sends data to all of the connected clients synchronously.
public Multicast ( 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

Multicast() 공개 메소드

Sends data to all of the connected clients synchronously.
public Multicast ( object serializableObject ) : void
serializableObject object The serializable object that is to be sent.
리턴 void

Multicast() 공개 메소드

Sends data to all of the connected clients synchronously.
public Multicast ( string data ) : void
data string The plain-text data that is to be sent.
리턴 void

MulticastAsync() 공개 메소드

Sends data to all of the connected clients asynchronously.
public MulticastAsync ( byte data ) : WaitHandle[]
data byte The binary data that is to be sent.
리턴 WaitHandle[]

MulticastAsync() 공개 메소드

Sends data to all of the connected clients asynchronously.
public MulticastAsync ( 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 .
리턴 WaitHandle[]

MulticastAsync() 공개 메소드

Sends data to all of the connected clients asynchronously.
public MulticastAsync ( object serializableObject ) : WaitHandle[]
serializableObject object The serializable object that is to be sent.
리턴 WaitHandle[]

MulticastAsync() 공개 메소드

Sends data to all of the connected clients asynchronously.
public MulticastAsync ( string data ) : WaitHandle[]
data string The plain-text data that is to be sent.
리턴 WaitHandle[]

OnClientConnected() 보호된 메소드

Raises the ClientConnected event.
protected OnClientConnected ( Guid clientID ) : void
clientID Guid ID of client to send to event.
리턴 void

OnClientConnectingException() 보호된 메소드

Raises the ClientConnectingException event.
protected OnClientConnectingException ( Exception ex ) : void
ex Exception The encountered when connecting to the client.
리턴 void

OnClientDisconnected() 보호된 메소드

Raises the ClientDisconnected event.
protected OnClientDisconnected ( Guid clientID ) : void
clientID Guid ID of client to send to event.
리턴 void

OnReceiveClientData() 보호된 메소드

Raises the ReceiveClientData event.
This event is automatically raised by call to OnReceiveClientDataComplete so that inheritors never need to worry about raising this event. This method is only included here in case any custom server implementations need to explicitly raise this event.
protected OnReceiveClientData ( Guid clientID, int size ) : void
clientID Guid ID of the client from which data is received.
size int Number of bytes received from the client.
리턴 void

OnReceiveClientDataComplete() 보호된 메소드

Raises the ReceiveClientDataComplete event.
protected OnReceiveClientDataComplete ( Guid clientID, byte data, int size ) : void
clientID Guid ID of the client from which data is received.
data byte Data received from the client.
size int Number of bytes received from the client.
리턴 void

OnReceiveClientDataException() 보호된 메소드

Raises the ReceiveClientDataException event.
protected OnReceiveClientDataException ( Guid clientID, Exception ex ) : void
clientID Guid ID of client to send to event.
ex Exception Exception to send to event.
리턴 void

OnSendClientDataComplete() 보호된 메소드

Raises the SendClientDataComplete event.
protected OnSendClientDataComplete ( Guid clientID ) : void
clientID Guid ID of client to send to event.
리턴 void

OnSendClientDataException() 보호된 메소드

Raises the SendClientDataException event.
protected OnSendClientDataException ( Guid clientID, Exception ex ) : void
clientID Guid ID of client to send to event.
ex Exception Exception to send to event.
리턴 void

OnSendClientDataStart() 보호된 메소드

Raises the SendClientDataStart event.
protected OnSendClientDataStart ( Guid clientID ) : void
clientID Guid ID of client to send to event.
리턴 void

OnServerStarted() 보호된 메소드

Raises the ServerStarted event.
protected OnServerStarted ( ) : void
리턴 void

OnServerStopped() 보호된 메소드

Raises the ServerStopped event.
protected OnServerStopped ( ) : void
리턴 void

OnUnhandledUserException() 보호된 메소드

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

ReStart() 보호된 메소드

Re-starts the server if currently running.
protected ReStart ( ) : void
리턴 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 ReceiveClientData event handler. Calling this method outside this event will have unexpected results.
public abstract Read ( Guid clientID, byte buffer, int startIndex, int length ) : int
clientID Guid ID of the client from which data buffer should be read.
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 server 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

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

When overridden in a derived class, sends data to the specified client asynchronously.
protected abstract SendDataToAsync ( Guid clientID, byte data, int offset, int length ) : WaitHandle
clientID Guid ID of the client to which the data is to be sent.
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 .
리턴 WaitHandle

SendTo() 공개 메소드

Sends data to the specified client synchronously.
public SendTo ( Guid clientID, byte data ) : void
clientID Guid ID of the client to which the data is to be sent.
data byte The binary data that is to be sent.
리턴 void

SendTo() 공개 메소드

Sends data to the specified client synchronously.
public SendTo ( Guid clientID, byte data, int offset, int length ) : void
clientID Guid ID of the client to which the data is to be sent.
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

SendTo() 공개 메소드

Sends data to the specified client synchronously.
public SendTo ( Guid clientID, object serializableObject ) : void
clientID Guid ID of the client to which the data is to be sent.
serializableObject object The serializable object that is to be sent.
리턴 void

SendTo() 공개 메소드

Sends data to the specified client synchronously.
public SendTo ( Guid clientID, string data ) : void
clientID Guid ID of the client to which the data is to be sent.
data string The plain-text data that is to be sent.
리턴 void

SendToAsync() 공개 메소드

Sends data to the specified client asynchronously.
public SendToAsync ( Guid clientID, byte data ) : WaitHandle
clientID Guid ID of the client to which the data is to be sent.
data byte The binary data that is to be sent.
리턴 WaitHandle

SendToAsync() 공개 메소드

Sends data to the specified client asynchronously.
public SendToAsync ( Guid clientID, byte data, int offset, int length ) : WaitHandle
clientID Guid ID of the client to which the data is to be sent.
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 .
리턴 WaitHandle

SendToAsync() 공개 메소드

Sends data to the specified client asynchronously.
public SendToAsync ( Guid clientID, object serializableObject ) : WaitHandle
clientID Guid ID of the client to which the data is to be sent.
serializableObject object The serializable object that is to be sent.
리턴 WaitHandle

SendToAsync() 공개 메소드

Sends data to the specified client asynchronously.
public SendToAsync ( Guid clientID, string data ) : WaitHandle
clientID Guid ID of the client to which the data is to be sent.
data string The plain-text data that is to be sent.
리턴 WaitHandle

ServerBase() 보호된 메소드

Initializes a new instance of the server.
protected ServerBase ( ) : System
리턴 System

ServerBase() 보호된 메소드

Initializes a new instance of the server.
protected ServerBase ( TransportProtocol transportProtocol, string configurationString ) : System
transportProtocol TransportProtocol One of the values.
configurationString string The data used by the server for initialization.
리턴 System

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

When overridden in a derived class, starts the server.
public abstract Start ( ) : void
리턴 void

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

When overridden in a derived class, stops the server.
public abstract Stop ( ) : void
리턴 void

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

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