Host Class

Definition

The Host is what receives and responds to a Client's requests

This base Host has no actual implementation of handling connections, a "communication layer" needs to be used for that, such as TCPHost

public abstract class Host : IDisposable
Inheritance
System.Object
Host
Derived
Implements
System.IDisposable

Constructors

Host(ILogger, Int32)

Creates a new Host instance

Fields

BufferSize

This size of the buffer

DefaultBufferSize

The default size of the buffers

Logger

Logger

Properties

ConnectionCount

Count of number of connections

HasDisposed

Has this object been disposed

HideStacktrace

Hides the stacktrace from the client when an System.Exception is thrown

IsRunning

Is the Host running?

MaxConnectionsCount

What is the maximum amount of connections

TypeReaderWriterManager

The TypeReaderWriterManager for Host

Methods

AddService(Type, Object)

Adds a service to this Host

AddService<T>(T)

Adds a service to this Host

CheckDispose()

Checks if the object has been disposed

Dispose()

Destroys the Host instance

ProcessRequest(BufferedReader, BufferedWriter)

Processes a request from a client

You should only call this if you need to provide a custom BufferedReader and/or BufferedWriter. For example you are using a System.IO.Stream that needs System.IO.Stream.Position.

ProcessRequest(Stream, Stream)

Processes a request from a client

This override will automatically create the BufferedReader and BufferedWriter for you then call ProcessRequest(BufferedReader, BufferedWriter).

This is the preferred process request method to call.

SetProtocolVersion(Object)

Sets what protocol version to use.

Set value to null to reset back to none.

StartListening()

Starts listening for incoming requests

StartListeningAsync()

Starts listening for incoming requests