C# Class HttpServer.HttpClientContextImp

Contains a connection to a browser/client.
Inheritance: IHttpClientContext
Afficher le fichier Open project: 3di/3di-viewer-rei-libs

Méthodes publiques

Méthode Description
Disconnect ( SocketError error ) : void

Disconnect from client

HttpClientContextImp ( bool secured, IPEndPoint remoteEndPoint, RequestReceivedHandler requestHandler, ClientDisconnectedHandler disconnectHandler, Stream stream, ILogWriter writer ) : System

Initializes a new instance of the HttpClientContextImp class.

HttpClientContextImp ( bool secured, IPEndPoint remoteEndPoint, Stream stream, RequestReceivedHandler requestHandler ) : System

Initializes a new instance of the HttpClientContextImp class.

Respond ( string body ) : void

Send a response.

Respond ( string httpVersion, HttpServer.HttpStatusCode statusCode, string reason ) : void

Send a response.

Respond ( string httpVersion, HttpServer.HttpStatusCode statusCode, string reason, string body, string contentType ) : void

Send a response.

Send ( byte buffer ) : void

send a whole buffer

Send ( byte buffer, int offset, int size ) : void

Send data using the stream

Méthodes protégées

Méthode Description
Check100Continue ( ) : void

This method checks the request if a responde to 100-continue should be sent.

100 continue is a value in the Expect header. It's used to let the webserver determine if a request can be handled. The client waits for a reply before sending the body.

Private Methods

Méthode Description
OnReceive ( IAsyncResult ar ) : void
OnRequestCompleted ( IHttpRequest request ) : void

Method Details

Check100Continue() protected méthode

This method checks the request if a responde to 100-continue should be sent.
100 continue is a value in the Expect header. It's used to let the webserver determine if a request can be handled. The client waits for a reply before sending the body.
protected Check100Continue ( ) : void
Résultat void

Disconnect() public méthode

Disconnect from client
public Disconnect ( SocketError error ) : void
error SocketError error to report in the delegate.
Résultat void

HttpClientContextImp() public méthode

Initializes a new instance of the HttpClientContextImp class.
If beginreceive fails
public HttpClientContextImp ( bool secured, IPEndPoint remoteEndPoint, RequestReceivedHandler requestHandler, ClientDisconnectedHandler disconnectHandler, Stream stream, ILogWriter writer ) : System
secured bool true if the connection is secured (SSL/TLS)
remoteEndPoint System.Net.IPEndPoint client that connected.
requestHandler RequestReceivedHandler delegate handling incoming requests.
disconnectHandler ClientDisconnectedHandler delegate being called when a client disconnectes
stream Stream Stream used for communication
writer ILogWriter delegate used to write log entries
Résultat System

HttpClientContextImp() public méthode

Initializes a new instance of the HttpClientContextImp class.
If beginreceive fails
public HttpClientContextImp ( bool secured, IPEndPoint remoteEndPoint, Stream stream, RequestReceivedHandler requestHandler ) : System
secured bool true if the connection is secured (SSL/TLS)
remoteEndPoint System.Net.IPEndPoint client that connected
stream Stream Stream used for communication
requestHandler RequestReceivedHandler delegate handling incoming requests.
Résultat System

Respond() public méthode

Send a response.
public Respond ( string body ) : void
body string
Résultat void

Respond() public méthode

Send a response.
public Respond ( string httpVersion, HttpServer.HttpStatusCode statusCode, string reason ) : void
httpVersion string Either HttpHelper.HTTP10 or HttpHelper.HTTP11
statusCode HttpServer.HttpStatusCode http status code
reason string reason for the status code.
Résultat void

Respond() public méthode

Send a response.
If httpVersion is invalid.
public Respond ( string httpVersion, HttpServer.HttpStatusCode statusCode, string reason, string body, string contentType ) : void
httpVersion string Either HttpHelper.HTTP10 or HttpHelper.HTTP11
statusCode HttpServer.HttpStatusCode http status code
reason string reason for the status code.
body string html body contents, can be null or empty.
contentType string A content type to return the body as, ie 'text/html' or 'text/plain', defaults to 'text/html' if null or empty
Résultat void

Send() public méthode

send a whole buffer
public Send ( byte buffer ) : void
buffer byte buffer to send
Résultat void

Send() public méthode

Send data using the stream
public Send ( byte buffer, int offset, int size ) : void
buffer byte Contains data to send
offset int Start position in buffer
size int number of bytes to send
Résultat void