C# Class Webserver.Responses.Response

Abstract class for responses Contains basic operations for sending data to the client
Inheritance: IDisposable
Mostrar archivo Open project: h07r0d/Netduino-Aquarium-Controller

Public Methods

Method Description
ConditionsCheckAndDataFill ( Request e ) : bool

Override this, check the URL and process data if needed

Dispose ( ) : void
Response ( string Name ) : System

Creates response to send back to client

SendResponse ( Request e ) : bool

Override this method to implement a response logic.

Protected Methods

Method Description
MimeType ( string Filename ) : string

Converts fileending into mime-type

Send200_OK ( string MimeType, int ContentLength, Socket Client ) : void

Creates header for 200 OK response

Send404_NotFound ( Socket Client ) : void

Sends a 404 Not Found response

SendData ( Socket client, byte data ) : int

Sends data to the client

SocketConnected ( Socket s ) : bool

Checks if socket is still connected

Method Details

ConditionsCheckAndDataFill() public abstract method

Override this, check the URL and process data if needed
public abstract ConditionsCheckAndDataFill ( Request e ) : bool
e Request
return bool

Dispose() public method

public Dispose ( ) : void
return void

MimeType() protected method

Converts fileending into mime-type
protected MimeType ( string Filename ) : string
Filename string File name or complete file path
return string

Response() public method

Creates response to send back to client
public Response ( string Name ) : System
Name string
return System

Send200_OK() protected method

Creates header for 200 OK response
protected Send200_OK ( string MimeType, int ContentLength, Socket Client ) : void
MimeType string MIME type of response
ContentLength int Byte count of response body /// The Socket connected with the client
Client System.Net.Sockets.Socket
return void

Send404_NotFound() protected method

Sends a 404 Not Found response
protected Send404_NotFound ( Socket Client ) : void
Client System.Net.Sockets.Socket
return void

SendData() protected method

Sends data to the client
protected SendData ( Socket client, byte data ) : int
client System.Net.Sockets.Socket Socket connected with the client
data byte Byte-array to be transmitted
return int

SendResponse() public abstract method

Override this method to implement a response logic.
public abstract SendResponse ( Request e ) : bool
e Request
return bool

SocketConnected() protected method

Checks if socket is still connected
protected SocketConnected ( Socket s ) : bool
s System.Net.Sockets.Socket Socket that should be checked
return bool