Search Results for

    Show / Hide Table of Contents

    Class Host

    The Host receives and responds to a Client's requests

    Inheritance
    Object
    Host
    PipesHost
    TCPHost
    Implements
    IDisposable
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: VoltRpc.Communication
    Assembly: VoltRpc.dll
    Syntax
    public abstract class Host : IDisposable

    Constructors

    | Improve this Doc View Source

    Host(ILogger, Int32)

    Creates a new Host instance

    Declaration
    protected Host(ILogger logger = null, int bufferSize = 8000)
    Parameters
    Type Name Description
    ILogger logger

    The ILogger to use

    Int32 bufferSize

    The initial size of the buffers

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Will throw if the buffer size is less then 16

    Fields

    | Improve this Doc View Source

    BufferSize

    This size of the buffer

    Declaration
    protected readonly int BufferSize
    Field Value
    Type Description
    Int32
    | Improve this Doc View Source

    DefaultBufferSize

    The default size of the buffers

    Declaration
    public const int DefaultBufferSize = 8000
    Field Value
    Type Description
    Int32
    | Improve this Doc View Source

    Logger

    Logger

    Declaration
    protected readonly ILogger Logger
    Field Value
    Type Description
    ILogger

    Properties

    | Improve this Doc View Source

    ConnectionCount

    Count of number of connections

    Declaration
    public int ConnectionCount { get; protected set; }
    Property Value
    Type Description
    Int32
    | Improve this Doc View Source

    HasDisposed

    Has this object been disposed

    Declaration
    public bool HasDisposed { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    HideStacktrace

    Hides the stacktrace from the client when an Exception is thrown

    Declaration
    public bool HideStacktrace { get; set; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    IsRunning

    Is the Host running?

    Declaration
    public bool IsRunning { get; protected set; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    MaxConnectionsCount

    What is the maximum amount of connections

    Declaration
    public int MaxConnectionsCount { get; set; }
    Property Value
    Type Description
    Int32
    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if value is 0 or less

    | Improve this Doc View Source

    TypeReaderWriterManager

    The TypeReaderWriterManager for Host

    Declaration
    public TypeReaderWriterManager TypeReaderWriterManager { get; }
    Property Value
    Type Description
    TypeReaderWriterManager

    Methods

    | Improve this Doc View Source

    AddService(Type, Object)

    Adds a service to this Host

    Declaration
    public void AddService(Type serviceType, object serviceObject)
    Parameters
    Type Name Description
    Type serviceType

    The Type of a service

    Object serviceObject

    The actual service Object itself

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the service has already been added

    ArgumentOutOfRangeException

    Thrown if serviceType is not an interface

    | Improve this Doc View Source

    AddService<T>(T)

    Adds a service to this Host

    Declaration
    public void AddService<T>(T service)
        where T : class
    Parameters
    Type Name Description
    T service

    The service Object to add

    Type Parameters
    Name Description
    T

    The service type

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the service has already been added

    ArgumentOutOfRangeException

    Thrown if T is not an interface

    | Improve this Doc View Source

    CheckDispose()

    Checks if the object has been disposed

    Declaration
    protected void CheckDispose()
    Exceptions
    Type Condition
    ObjectDisposedException
    | Improve this Doc View Source

    Dispose()

    Destroys the Host instance

    Declaration
    public virtual void Dispose()
    | Improve this Doc View Source

    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.

    Declaration
    protected void ProcessRequest(Stream readStream, Stream writeStream)
    Parameters
    Type Name Description
    Stream readStream

    The Stream to read from

    Stream writeStream

    The Stream to write to

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if either provide stream is null

    ArgumentOutOfRangeException

    Thrown if we can't read or write to the respected stream

    | Improve this Doc View Source

    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 Stream that needs Position.

    Declaration
    protected void ProcessRequest(BufferedReader reader, BufferedWriter writer)
    Parameters
    Type Name Description
    BufferedReader reader

    The BufferedReader to read from

    BufferedWriter writer

    The BufferedWriter to write to

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if either buffer is null

    | Improve this Doc View Source

    StartListening()

    Starts the Host to listen for requests

    Declaration
    public abstract Task StartListening()
    Returns
    Type Description
    Task

    Implements

    System.IDisposable
    • Improve this Doc
    • View Source
    ☀
    ☾
    In This Article
    Back to top
    Voltstro-Studios (c) 2021-2022
    ☀
    ☾