Show / Hide Table of Contents

    Class BaseListener

    Class that is the base implementation for all TCP listeners.

    Inheritance
    System.Object
    BaseListener
    GameListener<TConnectionFactory>
    GatewayListener<TConnectionFactory>
    Implements
    IListener
    Microsoft.Extensions.Hosting.IHostedService
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Fibula.Communications.Listeners
    Assembly: Fibula.Communications.dll
    Syntax
    public abstract class BaseListener : IListener, IHostedService

    Constructors

    | Improve this Doc View Source

    BaseListener(ILogger, BaseListenerOptions, ISocketConnectionFactory, IDoSDefender, Boolean, ITcpListener)

    Initializes a new instance of the BaseListener class.

    Declaration
    protected BaseListener(ILogger logger, BaseListenerOptions options, ISocketConnectionFactory socketConnectionFactory, IDoSDefender dosDefender, bool keepConnectionOpen = true, ITcpListener tcpListener = null)
    Parameters
    Type Name Description
    Serilog.ILogger logger

    A reference to the logger in use.

    BaseListenerOptions options

    The options for this listener.

    ISocketConnectionFactory socketConnectionFactory

    A reference to the socekt connection factory in use.

    IDoSDefender dosDefender

    A reference to a DoS defender service implementation.

    System.Boolean keepConnectionOpen

    Optional. A value indicating whether to maintain the connection open after processing a message in the connection.

    ITcpListener tcpListener

    Optional. An intance to use as the TCP listener, useful for unit testing.

    Properties

    | Improve this Doc View Source

    Logger

    Gets the logger in use.

    Declaration
    protected ILogger Logger { get; }
    Property Value
    Type Description
    Serilog.ILogger

    Methods

    | Improve this Doc View Source

    StartAsync(CancellationToken)

    Begins listening for requests.

    Declaration
    public Task StartAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken

    A token to observe for cancellation.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous listening operation.

    | Improve this Doc View Source

    StopAsync(CancellationToken)

    Stops the listener.

    Declaration
    public Task StopAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken

    A token to observe for cancellation.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Events

    | Improve this Doc View Source

    NewConnection

    Event fired when a new connection is enstablished.

    Declaration
    public event NewConnectionDelegate NewConnection
    Event Type
    Type Description
    NewConnectionDelegate

    Implements

    IListener
    Microsoft.Extensions.Hosting.IHostedService

    Extension Methods

    ObjectExtensions.YieldSingleItem<T>(T)
    ObjectExtensions.GetPropertyValue(Object, String)
    Validate.ThrowIfNull(Object, String)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2018-2020 | The Fibula Project
    Generated using DocFX | Jose L. Nuñez de Caceres et al.