C# 클래스 GSF.Communication.TlsServer

Represents a TCP-based communication server with SSL authentication and encryption.
상속: ServerBase
파일 보기 프로젝트 열기: GridProtectionAlliance/gsf 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
DefaultTrustedCertificatesPath string

Private Properties

프로퍼티 타입 설명
DefaultLocalCertificateSelectionCallback System.Security.Cryptography.X509Certificates.X509Certificate
LoadTrustedCertificates void
ProcessAccept void
ProcessIntegratedSecurityAuthentication void
ProcessReceivePayloadAware void
ProcessReceivePayloadUnaware void
ProcessSend void
ProcessTlsAuthentication void
ReceivePayloadAsync void
ReceivePayloadAwareAsync void
ReceivePayloadUnawareAsync void
SendPayload void
TerminateConnection void

공개 메소드들

메소드 설명
DisconnectOne ( System.Guid clientID ) : void

Disconnects the specified connected client.

LoadSettings ( ) : void

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

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

SaveSettings ( ) : void

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

Start ( ) : void

Starts the TcpServer synchronously and begins accepting client connections asynchronously.

Stop ( ) : void

Stops the TcpServer synchronously and disconnects all connected clients.

TlsServer ( ) : System

Initializes a new instance of the TcpServer class.

TlsServer ( IContainer container ) : System

Initializes a new instance of the TcpServer class.

TlsServer ( string configString ) : System

Initializes a new instance of the TcpServer class.

TryGetClient ( System.Guid clientID, TransportProvider &tlsClient ) : bool

Gets the TransportProvider{TlsSocket} object associated with the specified client ID.

TryGetClientPrincipal ( System.Guid clientID, WindowsPrincipal &clientPrincipal ) : bool

Gets the WindowsPrincipal object associated with the specified client ID.

보호된 메소드들

메소드 설명
SendDataToAsync ( System.Guid clientID, byte data, int offset, int length ) : WaitHandle

Sends data to the specified client asynchronously.

ValidateConfigurationString ( string configurationString ) : void

Validates the specified configurationString.

비공개 메소드들

메소드 설명
DefaultLocalCertificateSelectionCallback ( object sender, string targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string acceptableIssuers ) : X509Certificate

Returns the certificate set by the user.

LoadTrustedCertificates ( ) : void

Loads the list of trusted certificates into the default certificate checker.

ProcessAccept ( SocketAsyncEventArgs acceptArgs ) : void

Callback method for asynchronous accept operation.

ProcessIntegratedSecurityAuthentication ( IAsyncResult asyncResult ) : void
ProcessReceivePayloadAware ( IAsyncResult asyncResult ) : void

Callback method for asynchronous receive operation of payload data in "payload-aware" mode.

ProcessReceivePayloadUnaware ( IAsyncResult asyncResult ) : void

Callback method for asynchronous receive operation of payload data in "payload-unaware" mode.

ProcessSend ( IAsyncResult asyncResult ) : void

Callback method for asynchronous send operation.

ProcessTlsAuthentication ( IAsyncResult asyncResult ) : void

Callback method for asynchronous authenticate operation.

ReceivePayloadAsync ( TransportProvider client ) : void

Initiate method for asynchronous receive operation of payload data.

ReceivePayloadAwareAsync ( TransportProvider client, bool waitingForHeader ) : void

Initiate method for asynchronous receive operation of payload data in "payload-aware" mode.

ReceivePayloadUnawareAsync ( TransportProvider client ) : void

Initiate method for asynchronous receive operation of payload data in "payload-unaware" mode.

SendPayload ( TlsServerPayload payload ) : void

Asynchronous loop sends payloads on the socket.

TerminateConnection ( TransportProvider client, bool raiseEvent ) : void

Processes the termination of client.

메소드 상세

DisconnectOne() 공개 메소드

Disconnects the specified connected client.
Client does not exist for the specified .
public DisconnectOne ( System.Guid clientID ) : void
clientID System.Guid ID of the client to be disconnected.
리턴 void

LoadSettings() 공개 메소드

Loads saved TcpServer settings from the config file if the ServerBase.PersistSettings property is set to true.
public LoadSettings ( ) : void
리턴 void

Read() 공개 메소드

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 ServerBase.ReceiveClientData event handler. Calling this method outside this event will have unexpected results.
/// No received data buffer has been defined to read -or- /// Specified does not exist, cannot read buffer. /// is null. /// or is less than 0 -or- /// and will exceed length. ///
public Read ( System.Guid clientID, byte buffer, int startIndex, int length ) : int
clientID System.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 TcpServer settings to the config file if the ServerBase.PersistSettings property is set to true.
public SaveSettings ( ) : void
리턴 void

SendDataToAsync() 보호된 메소드

Sends data to the specified client asynchronously.
protected SendDataToAsync ( System.Guid clientID, byte data, int offset, int length ) : WaitHandle
clientID System.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 .
리턴 System.Threading.WaitHandle

Start() 공개 메소드

Starts the TcpServer synchronously and begins accepting client connections asynchronously.
Attempt is made to the when it is running.
public Start ( ) : void
리턴 void

Stop() 공개 메소드

Stops the TcpServer synchronously and disconnects all connected clients.
public Stop ( ) : void
리턴 void

TlsServer() 공개 메소드

Initializes a new instance of the TcpServer class.
public TlsServer ( ) : System
리턴 System

TlsServer() 공개 메소드

Initializes a new instance of the TcpServer class.
public TlsServer ( IContainer container ) : System
container IContainer object that contains the .
리턴 System

TlsServer() 공개 메소드

Initializes a new instance of the TcpServer class.
public TlsServer ( string configString ) : System
configString string Config string of the . See for format.
리턴 System

TryGetClient() 공개 메소드

Gets the TransportProvider{TlsSocket} object associated with the specified client ID.
Client does not exist for the specified .
public TryGetClient ( System.Guid clientID, TransportProvider &tlsClient ) : bool
clientID System.Guid ID of the client.
tlsClient TransportProvider The TLS client.
리턴 bool

TryGetClientPrincipal() 공개 메소드

Gets the WindowsPrincipal object associated with the specified client ID.
public TryGetClientPrincipal ( System.Guid clientID, WindowsPrincipal &clientPrincipal ) : bool
clientID System.Guid ID of the client.
clientPrincipal System.Security.Principal.WindowsPrincipal The principal of the client.
리턴 bool

ValidateConfigurationString() 보호된 메소드

Validates the specified configurationString.
Port property is missing. Port property value is not between and .
protected ValidateConfigurationString ( string configurationString ) : void
configurationString string Configuration string to be validated.
리턴 void

프로퍼티 상세

DefaultTrustedCertificatesPath 공개적으로 프로퍼티

Specifies the default value for the TrustedCertificatesPath property.
public string DefaultTrustedCertificatesPath
리턴 string