C# Class GSF.PhasorProtocols.MultiProtocolFrameParser.SharedTcpServerReference

Creates an instance of a TCP server that can be shared for multiple devices (e.g., an F-NET server)
Inheritance: IServer
Afficher le fichier Open project: GridProtectionAlliance/gsf

Méthodes publiques

Méthode Description
DisconnectAll ( ) : void

Disconnects all of the connected clients.

DisconnectOne ( System.Guid clientID ) : void

Disconnects a connected client.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Initialize ( ) : void

Initializes the state of the object.

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

Sends data to all of the connected clients synchronously.

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

Sends data to all of the connected clients asynchronously.

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

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

Sends data to the specified client synchronously.

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

Sends data to the specified client asynchronously.

Start ( ) : void

Starts the server.

Stop ( ) : void

Stops the server.

Private Methods

Méthode Description
GetLocalEndPoint ( ) : EndPoint

Determines the local end point this server intends to listen on via configuration string properties.

GetSharedServer ( ) : void

Gets a reference to the shared server listening on this server's local end point.

ReturnSharedServer ( ) : void

Releases a reference to this server's shared server, and disposes of the shared server if nobody is using it.

SharedServer_ClientConnected ( object sender, EventArgs e ) : void
SharedServer_ClientConnectingException ( object sender, EventArgs e ) : void
SharedServer_ClientDisconnected ( object sender, EventArgs e ) : void
SharedServer_ReceiveClientData ( object sender, int>.EventArgs e ) : void
SharedServer_ReceiveClientDataException ( object sender, Exception>.EventArgs e ) : void
SharedServer_SendClientDataException ( object sender, Exception>.EventArgs e ) : void
SharedServer_ServerStarted ( object sender, EventArgs e ) : void
SharedServer_ServerStopped ( object sender, EventArgs e ) : void
SharedServer_UnhandledUserException ( object sender, EventArgs e ) : void
TerminateSharedClient ( ) : void

Terminates the server as quickly as possible and removes it from the collection of shared servers.

Method Details

DisconnectAll() public méthode

Disconnects all of the connected clients.
public DisconnectAll ( ) : void
Résultat void

DisconnectOne() public méthode

Disconnects a connected client.
public DisconnectOne ( System.Guid clientID ) : void
clientID System.Guid ID of the client to be disconnected.
Résultat void

Dispose() public méthode

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
Résultat void

Initialize() public méthode

Initializes the state of the object.
public Initialize ( ) : void
Résultat void

Multicast() public méthode

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 .
Résultat void

MulticastAsync() public méthode

Sends data to all of the connected clients asynchronously.
public MulticastAsync ( byte data, int offset, int length ) : System.Threading.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[]

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 ReceiveClientData event handler. Calling this method outside this event will have unexpected results.
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 .
Résultat int

SendTo() public méthode

Sends data to the specified client synchronously.
public SendTo ( System.Guid clientID, byte data, int offset, int length ) : void
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 .
Résultat void

SendToAsync() public méthode

Sends data to the specified client asynchronously.
public SendToAsync ( 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 .
Résultat System.Threading.WaitHandle

Start() public méthode

Starts the server.
public Start ( ) : void
Résultat void

Stop() public méthode

Stops the server.
public Stop ( ) : void
Résultat void