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
Show file Open project: GridProtectionAlliance/gsf

Public Methods

Method 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

Method 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 method

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

DisconnectOne() public method

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

Dispose() public method

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

Initialize() public method

Initializes the state of the object.
public Initialize ( ) : void
return void

Multicast() public method

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 .
return void

MulticastAsync() public method

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 .
return System.Threading.WaitHandle[]

Read() public method

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 .
return int

SendTo() public method

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 .
return void

SendToAsync() public method

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 .
return System.Threading.WaitHandle

Start() public method

Starts the server.
public Start ( ) : void
return void

Stop() public method

Stops the server.
public Stop ( ) : void
return void