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

Represents an SSL server that can handle multiple secure client sessions. More...

Inheritance diagram for XmobiTea.ProtonNetServer.SslServer:
XmobiTea.ProtonNetServer.ITcpServer XmobiTea.ProtonNetServer.IServer XmobiTea.ProtonNet.Server.Socket.Server.SocketSslServer XmobiTea.ProtonNetServer.HttpsServer XmobiTea.ProtonNet.Server.WebApi.Server.WebApiHttpsServer XmobiTea.ProtonNetServer.WssServer XmobiTea.ProtonNet.Server.Socket.Server.SocketWssServer

Public Member Functions

 SslServer (string address, int port, TcpServerOptions options, SslOptions sslOptions)
 Initializes a new instance of the SslServer class with the specified address, port, options, and Ssl options.
 
virtual bool Start ()
 Starts the SSL server.
 
virtual bool Stop ()
 Stops the SSL server.
 
virtual bool Restart ()
 Restarts the SSL server.
 
virtual bool BroadcastAll (byte[] buffer)
 Broadcasts a message to all connected secure sessions.
 
virtual bool BroadcastAll (byte[] buffer, int position, int length)
 Broadcasts a message to all connected secure sessions with a specified position and length.
 
virtual bool BroadcastAllAsync (byte[] buffer)
 Broadcasts a message asynchronously to all connected secure sessions.
 
virtual bool BroadcastAllAsync (byte[] buffer, int position, int length)
 Broadcasts a message asynchronously to all connected secure sessions with a specified position and length.
 
virtual bool DisconnectAll ()
 Disconnects all connected secure sessions.
 
IServerNetworkStatistics GetNetworkStatistics ()
 Gets the network statistics for the server.
 
SslSession GetSession (string id)
 Finds a secure session by its identifier.
 
void Dispose ()
 Disposes the server and its resources.
 
- Public Member Functions inherited from XmobiTea.ProtonNetServer.IServer

Protected Member Functions

virtual string CreateRandomId ()
 Creates a random identifier for the server.
 
virtual SslSession CreateSession ()
 Creates a new secure session. Override this method to provide custom session behavior.
 
virtual void OnStarting ()
 Called when the server is starting. Override this method to add custom logic during server startup.
 
virtual void OnStarted ()
 Called after the server has started successfully. Override this method to add custom logic after server startup.
 
virtual void OnStopping ()
 Called when the server is stopping. Override this method to add custom logic during server shutdown.
 
virtual void OnStopped ()
 Called after the server has stopped successfully. Override this method to add custom logic after server shutdown.
 
virtual void OnConnecting (SslSession session)
 Called when a session is connecting. Override this method to handle session-specific logic during the connection process.
 
virtual void OnConnected (SslSession session)
 Called after a session has connected successfully. Override this method to handle session-specific logic after the connection process.
 
virtual void OnHandshaking (SslSession session)
 Called when a session is undergoing the SSL/TLS handshake process. Override this method to handle session-specific logic during the handshake process.
 
virtual void OnHandshaked (SslSession session)
 Called after a session has successfully completed the SSL/TLS handshake. Override this method to handle session-specific logic after the handshake process.
 
virtual void OnDisconnecting (SslSession session)
 Called when a session is disconnecting. Override this method to handle session-specific logic during the disconnection process.
 
virtual void OnDisconnected (SslSession session)
 Called after a session has disconnected successfully. Override this method to handle session-specific logic after the disconnection process.
 
virtual void OnError (SocketError error)
 Called when a socket error occurs. Override this method to handle errors in a custom way.
 
virtual void Dispose (bool disposingManagedResources)
 Disposes the server, optionally releasing managed resources.
 

Properties

string Id [get]
 Gets the unique identifier for the server instance.
 
SslOptions SslOptions [get]
 Gets the Ssl options for secure communication.
 
string Address [get]
 Gets the server's IP address.
 
int Port [get]
 Gets the server's port number.
 
EndPoint EndPoint [get]
 Gets the server's endpoint.
 
ConcurrentDictionary< string, SslSessionSessions [get]
 Gets the collection of active secure sessions.
 
int ConnectedSessions [get]
 Gets the number of connected secure sessions.
 
TcpServerOptions Options [get]
 Gets the TCP server options.
 
bool IsStarted [get]
 Gets a value indicating whether the server is started.
 
bool IsAccepting [get]
 Gets a value indicating whether the server is currently accepting connections.
 
bool IsDisposed [get]
 Gets a value indicating whether the server is disposed.
 
bool IsSocketDisposed [get]
 Gets a value indicating whether the server socket is disposed.
 

Detailed Description

Represents an SSL server that can handle multiple secure client sessions.

Constructor & Destructor Documentation

◆ SslServer()

XmobiTea.ProtonNetServer.SslServer.SslServer ( string address,
int port,
TcpServerOptions options,
SslOptions sslOptions )

Initializes a new instance of the SslServer class with the specified address, port, options, and Ssl options.

Parameters
addressThe server's IP address.
portThe server's port number.
optionsThe TCP server options.
sslOptionsThe Ssl options for secure communication.

Member Function Documentation

◆ BroadcastAll() [1/2]

virtual bool XmobiTea.ProtonNetServer.SslServer.BroadcastAll ( byte[] buffer)
virtual

Broadcasts a message to all connected secure sessions.

Parameters
bufferThe data buffer to broadcast.
Returns
True if the message was broadcasted successfully; otherwise, false.

Implements XmobiTea.ProtonNetServer.IServer.

Reimplemented in XmobiTea.ProtonNetServer.WssServer.

◆ BroadcastAll() [2/2]

virtual bool XmobiTea.ProtonNetServer.SslServer.BroadcastAll ( byte[] buffer,
int position,
int length )
virtual

Broadcasts a message to all connected secure sessions with a specified position and length.

Parameters
bufferThe data buffer to broadcast.
positionThe starting position in the buffer.
lengthThe length of the data to broadcast.
Returns
True if the message was broadcasted successfully; otherwise, false.

Implements XmobiTea.ProtonNetServer.IServer.

Reimplemented in XmobiTea.ProtonNetServer.WssServer.

◆ BroadcastAllAsync() [1/2]

virtual bool XmobiTea.ProtonNetServer.SslServer.BroadcastAllAsync ( byte[] buffer)
virtual

Broadcasts a message asynchronously to all connected secure sessions.

Parameters
bufferThe data buffer to broadcast.
Returns
True if the message was broadcasted successfully; otherwise, false.

Implements XmobiTea.ProtonNetServer.IServer.

Reimplemented in XmobiTea.ProtonNetServer.WssServer.

◆ BroadcastAllAsync() [2/2]

virtual bool XmobiTea.ProtonNetServer.SslServer.BroadcastAllAsync ( byte[] buffer,
int position,
int length )
virtual

Broadcasts a message asynchronously to all connected secure sessions with a specified position and length.

Parameters
bufferThe data buffer to broadcast.
positionThe starting position in the buffer.
lengthThe length of the data to broadcast.
Returns
True if the message was broadcasted successfully; otherwise, false.

Implements XmobiTea.ProtonNetServer.IServer.

Reimplemented in XmobiTea.ProtonNetServer.WssServer.

◆ CreateRandomId()

virtual string XmobiTea.ProtonNetServer.SslServer.CreateRandomId ( )
protectedvirtual

Creates a random identifier for the server.

Returns
A random string identifier.

◆ CreateSession()

virtual SslSession XmobiTea.ProtonNetServer.SslServer.CreateSession ( )
protectedvirtual

◆ DisconnectAll()

virtual bool XmobiTea.ProtonNetServer.SslServer.DisconnectAll ( )
virtual

Disconnects all connected secure sessions.

Returns
True if all sessions were disconnected successfully; otherwise, false.

Implements XmobiTea.ProtonNetServer.IServer.

◆ Dispose()

virtual void XmobiTea.ProtonNetServer.SslServer.Dispose ( bool disposingManagedResources)
protectedvirtual

Disposes the server, optionally releasing managed resources.

Parameters
disposingManagedResourcesTrue to release managed resources; otherwise, false.

◆ GetNetworkStatistics()

IServerNetworkStatistics XmobiTea.ProtonNetServer.SslServer.GetNetworkStatistics ( )

Gets the network statistics for the server.

Returns
An instance of IServerNetworkStatistics representing the network statistics.

Implements XmobiTea.ProtonNetServer.IServer.

◆ GetSession()

SslSession XmobiTea.ProtonNetServer.SslServer.GetSession ( string id)

Finds a secure session by its identifier.

Parameters
idThe session identifier.
Returns
The SslSession if found; otherwise, null.

◆ OnConnected()

virtual void XmobiTea.ProtonNetServer.SslServer.OnConnected ( SslSession session)
protectedvirtual

Called after a session has connected successfully. Override this method to handle session-specific logic after the connection process.

Parameters
sessionThe session that has connected.

◆ OnConnecting()

virtual void XmobiTea.ProtonNetServer.SslServer.OnConnecting ( SslSession session)
protectedvirtual

Called when a session is connecting. Override this method to handle session-specific logic during the connection process.

Parameters
sessionThe session that is connecting.

◆ OnDisconnected()

virtual void XmobiTea.ProtonNetServer.SslServer.OnDisconnected ( SslSession session)
protectedvirtual

Called after a session has disconnected successfully. Override this method to handle session-specific logic after the disconnection process.

Parameters
sessionThe session that has disconnected.

◆ OnDisconnecting()

virtual void XmobiTea.ProtonNetServer.SslServer.OnDisconnecting ( SslSession session)
protectedvirtual

Called when a session is disconnecting. Override this method to handle session-specific logic during the disconnection process.

Parameters
sessionThe session that is disconnecting.

◆ OnError()

virtual void XmobiTea.ProtonNetServer.SslServer.OnError ( SocketError error)
protectedvirtual

Called when a socket error occurs. Override this method to handle errors in a custom way.

Parameters
errorThe SocketError that occurred.

◆ OnHandshaked()

virtual void XmobiTea.ProtonNetServer.SslServer.OnHandshaked ( SslSession session)
protectedvirtual

Called after a session has successfully completed the SSL/TLS handshake. Override this method to handle session-specific logic after the handshake process.

Parameters
sessionThe session that has completed the handshake.

◆ OnHandshaking()

virtual void XmobiTea.ProtonNetServer.SslServer.OnHandshaking ( SslSession session)
protectedvirtual

Called when a session is undergoing the SSL/TLS handshake process. Override this method to handle session-specific logic during the handshake process.

Parameters
sessionThe session that is handshaking.

◆ Restart()

virtual bool XmobiTea.ProtonNetServer.SslServer.Restart ( )
virtual

Restarts the SSL server.

Returns
True if the server restarted successfully; otherwise, false.

Implements XmobiTea.ProtonNetServer.IServer.

◆ Start()

virtual bool XmobiTea.ProtonNetServer.SslServer.Start ( )
virtual

Starts the SSL server.

Returns
True if the server started successfully; otherwise, false.

Implements XmobiTea.ProtonNetServer.IServer.

◆ Stop()

virtual bool XmobiTea.ProtonNetServer.SslServer.Stop ( )
virtual

Stops the SSL server.

Returns
True if the server stopped successfully; otherwise, false.

Implements XmobiTea.ProtonNetServer.IServer.


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