|
ProtonNet Server 1.0
An Open Solution for all your socket or web api needs.
|
Provides the implementation for a TCP session, handling connection, data transmission, and disconnection. More...
Public Member Functions | |
| TcpSession (TcpServer server) | |
| Initializes a new instance of the TcpSession class. | |
| INetworkStatistics | GetNetworkStatistics () |
| Gets the network statistics for this session. | |
| virtual bool | Disconnect () |
| Disconnects the session. | |
| virtual int | Send (byte[] buffer) |
| Sends data synchronously. | |
| virtual int | Send (byte[] buffer, int position, int length) |
| Sends data synchronously with the specified position and length. | |
| virtual bool | SendAsync (byte[] buffer) |
| Sends data asynchronously. | |
| virtual bool | SendAsync (byte[] buffer, int position, int length) |
| Sends data asynchronously with the specified position and length. | |
| void | Dispose () |
| Releases all resources used by the current instance of the TcpSession class. | |
Public Member Functions inherited from XmobiTea.ProtonNetServer.ISession | |
Protected Member Functions | |
| virtual void | OnConnecting () |
| Invoked when the session is in the process of connecting. | |
| virtual void | OnConnected () |
| Invoked when the session has successfully connected. | |
| virtual void | OnDisconnecting () |
| Invoked when the session is in the process of disconnecting. | |
| virtual void | OnDisconnected () |
| Invoked when the session has successfully disconnected. | |
| virtual void | OnReceived (byte[] buffer, int position, int length) |
| Invoked when data is received from the remote endpoint. | |
| virtual void | OnSent (int sent, int pending) |
| Invoked when data is successfully sent to the remote endpoint. | |
| virtual void | OnEmpty () |
| Invoked when the send buffer is empty. | |
| virtual void | OnError (SocketError error) |
| Invoked when an error occurs during the session operation. | |
| virtual void | Dispose (bool disposingManagedResources) |
| Releases the unmanaged resources used by the TcpSession and optionally releases the managed resources. | |
Properties | |
| string | Id [get] |
| Gets the unique identifier for this session. | |
| TcpServer | Server [get] |
| Gets the server that owns this session. | |
| Socket | Socket [get] |
| Gets the socket associated with this session. | |
| bool | IsConnected [get] |
| Gets a value indicating whether the session is currently connected. | |
| bool | IsDisposed [get] |
| Gets a value indicating whether the session has been disposed. | |
| bool | IsSocketDisposed [get] |
| Gets a value indicating whether the socket has been disposed. | |
| TcpServerOptions | Options [get] |
| Gets the options for the TCP server. | |
Provides the implementation for a TCP session, handling connection, data transmission, and disconnection.
| XmobiTea.ProtonNetServer.TcpSession.TcpSession | ( | TcpServer | server | ) |
Initializes a new instance of the TcpSession class.
| server | The server that owns this session. |
|
virtual |
Disconnects the session.
Implements XmobiTea.ProtonNetServer.ISession.
|
protectedvirtual |
Releases the unmanaged resources used by the TcpSession and optionally releases the managed resources.
| disposingManagedResources | True to release both managed and unmanaged resources; false to release only unmanaged resources. |
Reimplemented in XmobiTea.ProtonNet.Server.Socket.Sessions.SocketTcpSession, and XmobiTea.ProtonNet.Server.Socket.Sessions.SocketWsSession.
| INetworkStatistics XmobiTea.ProtonNetServer.TcpSession.GetNetworkStatistics | ( | ) |
Gets the network statistics for this session.
Implements XmobiTea.ProtonNetServer.ISession.
|
protectedvirtual |
Invoked when the session has successfully connected.
Reimplemented in XmobiTea.ProtonNet.Server.Socket.Sessions.SocketTcpSession, and XmobiTea.ProtonNet.Server.WebApi.Sessions.WebApiHttpSession.
|
protectedvirtual |
Invoked when the session has successfully disconnected.
Reimplemented in XmobiTea.ProtonNet.Server.Socket.Sessions.SocketTcpSession, XmobiTea.ProtonNet.Server.WebApi.Sessions.WebApiHttpSession, XmobiTea.ProtonNetServer.HttpSession, and XmobiTea.ProtonNetServer.WsSession.
|
protectedvirtual |
Invoked when the session is in the process of disconnecting.
Reimplemented in XmobiTea.ProtonNetServer.WsSession.
|
protectedvirtual |
Invoked when an error occurs during the session operation.
| error | The socket error that occurred. |
|
protectedvirtual |
Invoked when data is received from the remote endpoint.
| buffer | The buffer containing the received data. |
| position | The position in the buffer where the received data starts. |
| length | The length of the received data. |
Reimplemented in XmobiTea.ProtonNet.Server.Socket.Sessions.SocketTcpSession, XmobiTea.ProtonNetServer.HttpSession, and XmobiTea.ProtonNetServer.WsSession.
|
protectedvirtual |
Invoked when data is successfully sent to the remote endpoint.
| sent | The number of bytes sent. |
| pending | The number of bytes pending in the send buffer. |
|
virtual |
Sends data synchronously.
| buffer | The buffer containing the data to send. |
Implements XmobiTea.ProtonNetServer.ISession.
Reimplemented in XmobiTea.ProtonNet.Server.Socket.Sessions.SocketWsSession.
|
virtual |
Sends data synchronously with the specified position and length.
| buffer | The buffer containing the data to send. |
| position | The starting position in the buffer. |
| length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.ISession.
|
virtual |
Sends data asynchronously.
| buffer | The buffer containing the data to send. |
Implements XmobiTea.ProtonNetServer.ISession.
Reimplemented in XmobiTea.ProtonNet.Server.Socket.Sessions.SocketWsSession.
|
virtual |
Sends data asynchronously with the specified position and length.
| buffer | The buffer containing the data to send. |
| position | The starting position in the buffer. |
| length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.ISession.