ProtonNet Server 1.0
An Open Solution for all your socket or web api needs.
Loading...
Searching...
No Matches
XmobiTea.ProtonNetClient.SslClient Class Reference

Implements an SSL/TLS client for secure communication over a TCP connection. More...

Inheritance diagram for XmobiTea.ProtonNetClient.SslClient:
XmobiTea.ProtonNetClient.ITcpClient XmobiTea.ProtonNetClient.IClient XmobiTea.ProtonNet.Client.Socket.Clients.SocketSslClient XmobiTea.ProtonNetClient.HttpsClient XmobiTea.ProtonNetClient.WssClient XmobiTea.ProtonNet.Client.Socket.Clients.SocketWssClient

Public Member Functions

 SslClient (string address, int port, TcpClientOptions options, SslOptions sslOptions)
 Initializes a new instance of the SslClient class.
 
INetworkStatistics GetNetworkStatistics ()
 Gets the network statistics associated with the client.
 
virtual bool Connect ()
 Connects the client to the server synchronously and initiates the SSL/TLS handshake.
 
virtual bool Disconnect ()
 Disconnects the client from the server synchronously.
 
virtual bool Reconnect ()
 Reconnects the client to the server by first disconnecting, then reconnecting and initiating the SSL/TLS handshake.
 
virtual bool ConnectAsync ()
 Connects the client to the server asynchronously and initiates the SSL/TLS handshake.
 
virtual bool DisconnectAsync ()
 Disconnects the client from the server asynchronously.
 
virtual bool ReconnectAsync ()
 Reconnects the client to the server asynchronously by first disconnecting, then reconnecting and initiating the SSL/TLS handshake.
 
virtual int Send (byte[] buffer)
 Sends data to the server synchronously through the SSL/TLS stream.
 
virtual int Send (byte[] buffer, int position, int length)
 Sends data to the server synchronously through the SSL/TLS stream starting from a specific position in the buffer.
 
virtual bool SendAsync (byte[] buffer)
 Sends data to the server asynchronously through the SSL/TLS stream.
 
virtual bool SendAsync (byte[] buffer, int position, int length)
 Sends data to the server asynchronously through the SSL/TLS stream starting from a specific position in the buffer.
 
void Dispose ()
 Disposes the SSL client, releasing all resources.
 
- Public Member Functions inherited from XmobiTea.ProtonNetClient.IClient

Protected Member Functions

virtual void OnConnecting ()
 Called when the client is in the process of connecting. Can be overridden in derived classes to handle the event.
 
virtual void OnConnected ()
 Called when the client has successfully connected to the server. Can be overridden in derived classes to handle the event.
 
virtual void OnHandshaking ()
 Called when the SSL/TLS handshake is in progress. Can be overridden in derived classes to handle the event.
 
virtual void OnHandshaked ()
 Called when the SSL/TLS handshake has been completed. Can be overridden in derived classes to handle the event.
 
virtual void OnDisconnecting ()
 Called when the client is in the process of disconnecting. Can be overridden in derived classes to handle the event.
 
virtual void OnDisconnected ()
 Called when the client has successfully disconnected from the server. Can be overridden in derived classes to handle the event.
 
virtual void OnReceived (byte[] buffer, int position, int length)
 Called when data is received from the server through the SSL/TLS stream. Can be overridden in derived classes to handle the event.
 
virtual void OnSent (int sent, int pending)
 Called when data is successfully sent to the server through the SSL/TLS stream. Can be overridden in derived classes to handle the event.
 
virtual void OnEmpty ()
 Called when the send buffer is empty. Can be overridden in derived classes to handle the event.
 
virtual void OnError (SocketError error)
 Called when an error occurs during socket operations. Can be overridden in derived classes to handle the event.
 
virtual void Dispose (bool disposingManagedResources)
 Disposes the SSL client, releasing managed resources if specified.
 

Properties

SslOptions SslOptions [get]
 Gets the Ssl options used for SSL/TLS encryption and authentication.
 
bool IsHandshaking [get]
 Gets a value indicating whether the SSL/TLS handshake is in progress.
 
bool IsHandshaked [get]
 Gets a value indicating whether the SSL/TLS handshake has been completed.
 
string Id [get]
 A unique identifier for this client instance.
 
string Address [get]
 The address of the remote server to which the client is connecting.
 
int Port [get]
 The port number on the remote server to which the client is connecting.
 
EndPoint EndPoint [get]
 The endpoint representing the address and port of the remote server.
 
Socket Socket [get]
 The socket used for network communication.
 
TcpClientOptions Options [get]
 Configuration options for the TCP client.
 
bool IsConnecting [get]
 Indicates whether the client is currently in the process of connecting.
 
bool IsConnected [get]
 Indicates whether the client is currently connected to the server.
 
bool IsDisposed [get]
 Indicates whether the client has been disposed.
 
bool IsSocketDisposed [get]
 Indicates whether the socket has been disposed.
 

Detailed Description

Implements an SSL/TLS client for secure communication over a TCP connection.

Constructor & Destructor Documentation

◆ SslClient()

XmobiTea.ProtonNetClient.SslClient.SslClient ( string address,
int port,
TcpClientOptions options,
SslOptions sslOptions )

Initializes a new instance of the SslClient class.

Parameters
addressThe server address to connect to.
portThe port number on the server.
optionsTCP client options for configuring the connection.
sslOptionsThe Ssl options for secure communication.

Member Function Documentation

◆ Connect()

virtual bool XmobiTea.ProtonNetClient.SslClient.Connect ( )
virtual

Connects the client to the server synchronously and initiates the SSL/TLS handshake.

Returns
True if the connection and handshake are successful; otherwise, false.

Implements XmobiTea.ProtonNetClient.IClient.

Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketSslClient, XmobiTea.ProtonNet.Client.Socket.Clients.SocketWssClient, and XmobiTea.ProtonNetClient.WssClient.

◆ ConnectAsync()

virtual bool XmobiTea.ProtonNetClient.SslClient.ConnectAsync ( )
virtual

Connects the client to the server asynchronously and initiates the SSL/TLS handshake.

Returns
True if the connection and handshake are successful; otherwise, false.

Implements XmobiTea.ProtonNetClient.IClient.

Reimplemented in XmobiTea.ProtonNetClient.WssClient.

◆ Disconnect()

virtual bool XmobiTea.ProtonNetClient.SslClient.Disconnect ( )
virtual

Disconnects the client from the server synchronously.

Returns
True if the disconnection is successful; otherwise, false.

Implements XmobiTea.ProtonNetClient.IClient.

Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketSslClient, and XmobiTea.ProtonNet.Client.Socket.Clients.SocketWssClient.

◆ DisconnectAsync()

virtual bool XmobiTea.ProtonNetClient.SslClient.DisconnectAsync ( )
virtual

Disconnects the client from the server asynchronously.

Returns
True if the disconnection is successful; otherwise, false.

Implements XmobiTea.ProtonNetClient.IClient.

◆ Dispose()

virtual void XmobiTea.ProtonNetClient.SslClient.Dispose ( bool disposingManagedResources)
protectedvirtual

Disposes the SSL client, releasing managed resources if specified.

Parameters
disposingManagedResourcesTrue to release managed resources; otherwise, false.

◆ GetNetworkStatistics()

INetworkStatistics XmobiTea.ProtonNetClient.SslClient.GetNetworkStatistics ( )

Gets the network statistics associated with the client.

Returns
An object implementing INetworkStatistics containing network statistics.

Implements XmobiTea.ProtonNetClient.IClient.

◆ OnConnected()

virtual void XmobiTea.ProtonNetClient.SslClient.OnConnected ( )
protectedvirtual

Called when the client has successfully connected to the server. Can be overridden in derived classes to handle the event.

Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketSslClient, and XmobiTea.ProtonNetClient.WssClient.

◆ OnConnecting()

virtual void XmobiTea.ProtonNetClient.SslClient.OnConnecting ( )
protectedvirtual

Called when the client is in the process of connecting. Can be overridden in derived classes to handle the event.

Reimplemented in XmobiTea.ProtonNetClient.WssClient.

◆ OnDisconnected()

virtual void XmobiTea.ProtonNetClient.SslClient.OnDisconnected ( )
protectedvirtual

Called when the client has successfully disconnected from the server. Can be overridden in derived classes to handle the event.

Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketSslClient, XmobiTea.ProtonNet.Client.Socket.Clients.SocketWssClient, XmobiTea.ProtonNetClient.HttpsClient, and XmobiTea.ProtonNetClient.WssClient.

◆ OnDisconnecting()

virtual void XmobiTea.ProtonNetClient.SslClient.OnDisconnecting ( )
protectedvirtual

Called when the client is in the process of disconnecting. Can be overridden in derived classes to handle the event.

Reimplemented in XmobiTea.ProtonNetClient.WssClient.

◆ OnError()

virtual void XmobiTea.ProtonNetClient.SslClient.OnError ( SocketError error)
protectedvirtual

Called when an error occurs during socket operations. Can be overridden in derived classes to handle the event.

Parameters
errorThe socket error that occurred.

◆ OnHandshaked()

virtual void XmobiTea.ProtonNetClient.SslClient.OnHandshaked ( )
protectedvirtual

Called when the SSL/TLS handshake has been completed. Can be overridden in derived classes to handle the event.

Reimplemented in XmobiTea.ProtonNetClient.WssClient.

◆ OnHandshaking()

virtual void XmobiTea.ProtonNetClient.SslClient.OnHandshaking ( )
protectedvirtual

Called when the SSL/TLS handshake is in progress. Can be overridden in derived classes to handle the event.

Reimplemented in XmobiTea.ProtonNetClient.WssClient.

◆ OnReceived()

virtual void XmobiTea.ProtonNetClient.SslClient.OnReceived ( byte[] buffer,
int position,
int length )
protectedvirtual

Called when data is received from the server through the SSL/TLS stream. Can be overridden in derived classes to handle the event.

Parameters
bufferThe buffer containing the received data.
positionThe starting position in the buffer.
lengthThe length of the received data.

Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketSslClient, XmobiTea.ProtonNetClient.HttpsClient, and XmobiTea.ProtonNetClient.WssClient.

◆ OnSent()

virtual void XmobiTea.ProtonNetClient.SslClient.OnSent ( int sent,
int pending )
protectedvirtual

Called when data is successfully sent to the server through the SSL/TLS stream. Can be overridden in derived classes to handle the event.

Parameters
sentThe number of bytes sent.
pendingThe number of bytes pending in the send buffer.

◆ Reconnect()

virtual bool XmobiTea.ProtonNetClient.SslClient.Reconnect ( )
virtual

Reconnects the client to the server by first disconnecting, then reconnecting and initiating the SSL/TLS handshake.

Returns
True if the reconnection and handshake are successful; otherwise, false.

Implements XmobiTea.ProtonNetClient.IClient.

Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketSslClient, and XmobiTea.ProtonNet.Client.Socket.Clients.SocketWssClient.

◆ ReconnectAsync()

virtual bool XmobiTea.ProtonNetClient.SslClient.ReconnectAsync ( )
virtual

Reconnects the client to the server asynchronously by first disconnecting, then reconnecting and initiating the SSL/TLS handshake.

Returns
True if the reconnection and handshake are successful; otherwise, false.

Implements XmobiTea.ProtonNetClient.IClient.

◆ Send() [1/2]

virtual int XmobiTea.ProtonNetClient.SslClient.Send ( byte[] buffer)
virtual

Sends data to the server synchronously through the SSL/TLS stream.

Parameters
bufferThe data to send.
Returns
The number of bytes sent.

Implements XmobiTea.ProtonNetClient.IClient.

Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketWssClient.

◆ Send() [2/2]

virtual int XmobiTea.ProtonNetClient.SslClient.Send ( byte[] buffer,
int position,
int length )
virtual

Sends data to the server synchronously through the SSL/TLS stream starting from a specific position in the buffer.

Parameters
bufferThe data to send.
positionThe starting position in the buffer.
lengthThe number of bytes to send.
Returns
The number of bytes sent.

Implements XmobiTea.ProtonNetClient.IClient.

◆ SendAsync() [1/2]

virtual bool XmobiTea.ProtonNetClient.SslClient.SendAsync ( byte[] buffer)
virtual

Sends data to the server asynchronously through the SSL/TLS stream.

Parameters
bufferThe data to send.
Returns
True if the data was sent successfully; otherwise, false.

Implements XmobiTea.ProtonNetClient.IClient.

Reimplemented in XmobiTea.ProtonNet.Client.Socket.Clients.SocketWssClient.

◆ SendAsync() [2/2]

virtual bool XmobiTea.ProtonNetClient.SslClient.SendAsync ( byte[] buffer,
int position,
int length )
virtual

Sends data to the server asynchronously through the SSL/TLS stream starting from a specific position in the buffer.

Parameters
bufferThe data to send.
positionThe starting position in the buffer.
lengthThe number of bytes to send.
Returns
True if the data was sent successfully; otherwise, false.

Implements XmobiTea.ProtonNetClient.IClient.


The documentation for this class was generated from the following file: