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

Represents an HTTP session, inheriting from the TcpSession class. More...

Inheritance diagram for XmobiTea.ProtonNetServer.HttpSession:
XmobiTea.ProtonNetServer.TcpSession XmobiTea.ProtonNetServer.IHttpSession XmobiTea.ProtonNetServer.ITcpSession XmobiTea.ProtonNetServer.ISession XmobiTea.ProtonNetServer.ISession XmobiTea.ProtonNet.Server.WebApi.Sessions.WebApiHttpSession XmobiTea.ProtonNetServer.WsSession XmobiTea.ProtonNet.Server.Socket.Sessions.SocketWsSession

Public Member Functions

 HttpSession (HttpServer server)
 Initializes a new instance of the HttpSession class.
 
virtual int SendResponse (HttpResponse response)
 Sends an HTTP response synchronously.
 
virtual bool SendResponseAsync (HttpResponse response)
 Sends an HTTP response asynchronously.
 
- Public Member Functions inherited from XmobiTea.ProtonNetServer.TcpSession
 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
- Public Member Functions inherited from XmobiTea.ProtonNetServer.IHttpSession

Protected Member Functions

override void OnReceived (byte[] buffer, int position, int length)
 Handles the data received from the client.
 
override void OnDisconnected ()
 Handles the session disconnection.
 
virtual void OnReceivedRequestHeader (HttpRequest request)
 Called when the request header is received.
 
virtual void OnReceivedRequest (HttpRequest request)
 Called when the full request is received.
 
virtual void OnReceivedRequestError (HttpRequest request, string error)
 Called when an error occurs while processing the request.
 
- Protected Member Functions inherited from XmobiTea.ProtonNetServer.TcpSession
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 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

HttpRequest Request [get]
 Gets the current HTTP request being processed.
 
HttpResponse Response [get]
 Gets the current HTTP response being processed.
 
- Properties inherited from XmobiTea.ProtonNetServer.TcpSession
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.
 

Detailed Description

Represents an HTTP session, inheriting from the TcpSession class.

Constructor & Destructor Documentation

◆ HttpSession()

XmobiTea.ProtonNetServer.HttpSession.HttpSession ( HttpServer server)

Initializes a new instance of the HttpSession class.

Parameters
serverThe HTTP server that manages this session.

Member Function Documentation

◆ OnDisconnected()

override void XmobiTea.ProtonNetServer.HttpSession.OnDisconnected ( )
protectedvirtual

◆ OnReceived()

override void XmobiTea.ProtonNetServer.HttpSession.OnReceived ( byte[] buffer,
int position,
int length )
protectedvirtual

Handles the data received from the client.

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

Reimplemented from XmobiTea.ProtonNetServer.TcpSession.

Reimplemented in XmobiTea.ProtonNetServer.WsSession.

◆ OnReceivedRequest()

virtual void XmobiTea.ProtonNetServer.HttpSession.OnReceivedRequest ( HttpRequest request)
protectedvirtual

Called when the full request is received.

Parameters
requestThe HTTP request.

Reimplemented in XmobiTea.ProtonNet.Server.WebApi.Sessions.WebApiHttpSession, and XmobiTea.ProtonNetServer.WsSession.

◆ OnReceivedRequestError()

virtual void XmobiTea.ProtonNetServer.HttpSession.OnReceivedRequestError ( HttpRequest request,
string error )
protectedvirtual

Called when an error occurs while processing the request.

Parameters
requestThe HTTP request.
errorThe error message.

Reimplemented in XmobiTea.ProtonNet.Server.WebApi.Sessions.WebApiHttpSession, and XmobiTea.ProtonNetServer.WsSession.

◆ OnReceivedRequestHeader()

virtual void XmobiTea.ProtonNetServer.HttpSession.OnReceivedRequestHeader ( HttpRequest request)
protectedvirtual

Called when the request header is received.

Parameters
requestThe HTTP request.

Reimplemented in XmobiTea.ProtonNetServer.WsSession.

◆ SendResponse()

virtual int XmobiTea.ProtonNetServer.HttpSession.SendResponse ( HttpResponse response)
virtual

Sends an HTTP response synchronously.

Parameters
responseThe HTTP response to send.
Returns
The number of bytes sent.

Implements XmobiTea.ProtonNetServer.IHttpSession.

◆ SendResponseAsync()

virtual bool XmobiTea.ProtonNetServer.HttpSession.SendResponseAsync ( HttpResponse response)
virtual

Sends an HTTP response asynchronously.

Parameters
responseThe HTTP response to send.
Returns
True if the response was sent successfully; otherwise, false.

Implements XmobiTea.ProtonNetServer.IHttpSession.


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