Diffusion .NET Classic API - Core and Common  5.9.4
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket Class Reference

Base class for socket-based communications. More...

Public Member Functions

void Start (bool async, bool secure)
 Connects to the Socket, which is initialised on construction. More...
 
void Disconnect (bool notify, ServerConnectionState serverState)
 Disconnects from the Socket. More...
 
 ClientSocket (ISyncMessageHandler messageHandler, IServerDetails serverDetails)
 Constructor. Initialises most properties based on the provided IServerDetails. More...
 
void Close ()
 Closes the socket. More...
 
void SendBytes (byte[] bytes)
 Sends an array of bytes to the Socket. More...
 
void SendBuffer (ByteBuffer buffer)
 Sends the bytes contained within the ByteBuffer to the Socket. More...
 
void Write (ByteBuffer buffer)
 Writes a byte buffer to the buffered network stream. The data will only be sent if the buffer is full or if Flush is called. More...
 
void Flush ()
 Flushes the underlying buffered network stream and sends the data to the server. More...
 
bool AuthenticateSecureConnection ()
 Authenticates the secure stream. If the current connection is not useing a secure stream it will return true. More...
 
void PrepareReceiveMode ()
 Starts the socket receive loop. More...
 

Properties

bool AllowSocketNotifications [get, set]
 Flag to allow socket notifications; this was implemented to prevent 'multiple' closure calls further up the API chain. More...
 
bool SocketConnected [get]
 Returns whether the actual socket object is connected. More...
 
ISyncMessageHandler MessageHandler [get, set]
 The synchronous message handler. More...
 
IServerDetails ServerDetails [get, set]
 Get/set the server details. More...
 
string Host [get, set]
 The host representing the Diffusion server. More...
 
int Port [get, set]
 The port of the Diffusion server. More...
 
int TcpKeepAliveInterval [get, set]
 The period on which to send a TCP 'keepalive'. More...
 
int MaxBufferSize [get, set]
 Get/set the maximum socket buffer size. More...
 
bool IsConnected [get, set]
 Indicates whether connection is established. More...
 

Events

EventHandler
< ServerClosedEventArgs
ConnectionClosed
 Called when the socket connection is closed. More...
 
EventHandler
< ServerClosedEventArgs
ConnectionFailed
 Called when the connection attempt fails. More...
 

Detailed Description

Base class for socket-based communications.

Constructor & Destructor Documentation

PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.ClientSocket ( ISyncMessageHandler  messageHandler,
IServerDetails  serverDetails 
)

Constructor. Initialises most properties based on the provided IServerDetails.

Parameters
messageHandler
serverDetails

Member Function Documentation

bool PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.AuthenticateSecureConnection ( )

Authenticates the secure stream. If the current connection is not useing a secure stream it will return true.

Returns
void PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.Close ( )

Closes the socket.

void PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.Disconnect ( bool  notify,
ServerConnectionState  serverState 
)

Disconnects from the Socket.

void PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.Flush ( )

Flushes the underlying buffered network stream and sends the data to the server.

void PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.PrepareReceiveMode ( )

Starts the socket receive loop.

void PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.SendBuffer ( ByteBuffer  buffer)

Sends the bytes contained within the ByteBuffer to the Socket.

Parameters
buffer
void PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.SendBytes ( byte[]  bytes)

Sends an array of bytes to the Socket.

Parameters
bytes
void PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.Start ( bool  async,
bool  secure 
)

Connects to the Socket, which is initialised on construction.

void PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.Write ( ByteBuffer  buffer)

Writes a byte buffer to the buffered network stream. The data will only be sent if the buffer is full or if Flush is called.

Parameters
bufferThe buffer that will be written to the stream.

Property Documentation

bool PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.AllowSocketNotifications
getset

Flag to allow socket notifications; this was implemented to prevent 'multiple' closure calls further up the API chain.

string PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.Host
getset

The host representing the Diffusion server.

bool PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.IsConnected
getset

Indicates whether connection is established.

int PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.MaxBufferSize
getset

Get/set the maximum socket buffer size.

ISyncMessageHandler PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.MessageHandler
getset

The synchronous message handler.

int PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.Port
getset

The port of the Diffusion server.

IServerDetails PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.ServerDetails
getset

Get/set the server details.

bool PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.SocketConnected
get

Returns whether the actual socket object is connected.

int PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.TcpKeepAliveInterval
getset

The period on which to send a TCP 'keepalive'.

Event Documentation

EventHandler<ServerClosedEventArgs> PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.ConnectionClosed

Called when the socket connection is closed.

EventHandler<ServerClosedEventArgs> PushTechnology.DiffusionCore.Connection.Sockets.ClientSocket.ConnectionFailed

Called when the connection attempt fails.