Class BaseListener
Class that is the base implementation for all TCP listeners.
Inheritance
Inherited Members
Namespace: Fibula.Communications.Listeners
Assembly: Fibula.Communications.dll
Syntax
public abstract class BaseListener : IListener, IHostedService
Constructors
| Improve this Doc View SourceBaseListener(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 SourceLogger
Gets the logger in use.
Declaration
protected ILogger Logger { get; }
Property Value
Type | Description |
---|---|
Serilog.ILogger |
Methods
| Improve this Doc View SourceStartAsync(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. |
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 SourceNewConnection
Event fired when a new connection is enstablished.
Declaration
public event NewConnectionDelegate NewConnection
Event Type
Type | Description |
---|---|
NewConnectionDelegate |