StellaOps.Router.Transport.Tcp.Server
Router TCP transport, server side: the listener a gateway accepts microservice connections with. Install Installing Stella Ops packagesRouter downloads and signaturesnet10.01.0.1-20261117T070237Zdotnet add package StellaOps.
Namespaces
| Namespace | Types |
|---|---|
StellaOps. | 3 |
namespace StellaOps.Router.Transport.Tcp.Server
| Type | Kind | Description |
|---|---|---|
TcpTransportServer | class | TCP transport server implementation for the gateway. |
TcpTransportServerPlugin | class | Plugin for the server side of the TCP transport, which a gateway listens with. |
TcpTransportServerServiceCollectionExtensions | class | Extension methods for registering the server side of the TCP transport. |
class TcpTransportServer
public sealed class TcpTransportServer : IGatewayConnectionTransportServer, IAsyncDisposable
TCP transport server implementation for the gateway.
Members
| Member | Kind | Summary |
|---|---|---|
TcpTransportServer( | constructor | Initializes a new instance of the TcpTransportServerclass. |
ConnectionCount | property | Gets the number of active connections. |
TransportType | property | The transport this server provides. |
OnConnection | event | Event raised when a connection is established. |
OnDisconnection | event | Event raised when a connection is lost. |
OnFrame | event | Event raised when a frame is received. |
CloseConnection( | method | Closes a connection. |
DisposeAsync( | method | See IAsync. |
GetConnection( | method | Gets a connection by ID. |
GetConnections( | method | Gets all active connections. |
SendFrameAsync( | method | Sends a frame to a connection. |
StartAsync( | method | Starts listening for incoming connections. |
StopAsync( | method | Stops accepting new connections. |
constructor TcpTransportServer(IOptions<TcpTransportOptions>, ILogger<TcpTransportServer>) #
TcpTransportServer(IOptions<TcpTransportOptions>, ILogger<TcpTransportServer>) #public TcpTransportServer(IOptions<TcpTransportOptions> options, ILogger<TcpTransportServer> logger)
Initializes a new instance of the TcpTransportServerclass.
property ConnectionCount #
ConnectionCount #public int ConnectionCount { get; }
Gets the number of active connections.
property TransportType #
TransportType #public TransportType TransportType { get; }
The transport this server provides.
event OnConnection #
OnConnection #public event Action<string, ConnectionState>? OnConnection
Event raised when a connection is established.
event OnDisconnection #
OnDisconnection #public event Action<string>? OnDisconnection
Event raised when a connection is lost.
event OnFrame #
OnFrame #public event Action<string, Frame>? OnFrame
Event raised when a frame is received.
method CloseConnection(string) #
CloseConnection(string) #public bool CloseConnection(string connectionId)
Closes a connection.
Parameters
connectionId: The connection identifier.
Returns
true when the connection existed and was closed.
method DisposeAsync() #
DisposeAsync() #public ValueTask DisposeAsync()
See IAsync.
method GetConnection(string) #
GetConnection(string) #public TcpConnection? GetConnection(string connectionId)
Gets a connection by ID.
Parameters
connectionId: The connection ID.
Returns
The connection, or null if not found.
method GetConnections() #
GetConnections() #public IEnumerable<TcpConnection> GetConnections()
Gets all active connections.
method SendFrameAsync(string, Frame, CancellationToken) #
SendFrameAsync(string, Frame, CancellationToken) #public Task SendFrameAsync(string connectionId, Frame frame, CancellationToken cancellationToken = default)
Sends a frame to a connection.
Parameters
connectionId: The connection ID.frame: The frame to send.cancellationToken: Cancellation token.
method StartAsync(CancellationToken) #
StartAsync(CancellationToken) #public Task StartAsync(CancellationToken cancellationToken)
Starts listening for incoming connections.
Parameters
cancellationToken: Cancellation token.
method StopAsync(CancellationToken) #
StopAsync(CancellationToken) #public Task StopAsync(CancellationToken cancellationToken)
Stops accepting new connections.
Parameters
cancellationToken: Cancellation token.
class TcpTransportServerPlugin
public sealed class TcpTransportServerPlugin : IRouterTransportPlugin
Plugin for the server side of the TCP transport, which a gateway listens with. The client side is TcpTransportPluginin Stella; both carry the transport name tcp.
Members
| Member | Kind | Summary |
|---|---|---|
TcpTransportServerPlugin( | constructor | Creates an instance of Tcp. |
DisplayName | property | Gets the human-readable display name for this transport. |
Mode | property | Gets the side of the transport this plugin registers: RouterTransportMode., RouterTransportMode., or RouterTransportMode.. |
TransportName | property | Gets the transport name (e.g., “tcp”, “tls”, “udp”, “rabbitmq”, “inmemory”, “messaging”), shared by the client and the server plugin of one transport. |
Register( | method | Registers transport services into the DI container for the side the context asks for. |
constructor TcpTransportServerPlugin() #
TcpTransportServerPlugin() #public TcpTransportServerPlugin()
Creates an instance of Tcp.
property DisplayName #
DisplayName #public string DisplayName { get; }
Gets the human-readable display name for this transport.
property Mode #
Mode #public RouterTransportMode Mode { get; }
Gets the side of the transport this plugin registers: RouterTransportMode., RouterTransportMode., or RouterTransportMode.. IRouterTransportPlugin.refuses a context that asks for a side outside this value (RouterTransportRegistrationContext.).
property TransportName #
TransportName #public string TransportName { get; }
Gets the transport name (e.g., “tcp”, “tls”, “udp”, “rabbitmq”, “inmemory”, “messaging”), shared by the client and the server plugin of one transport.
method Register(RouterTransportRegistrationContext) #
Register(RouterTransportRegistrationContext) #public void Register(RouterTransportRegistrationContext context)
Registers transport services into the DI container for the side the context asks for.
Parameters
context: The registration context containing services, configuration, and transport mode.
Exceptions
Invalid: The context asks for a side this plugin does not provide.Operation Exception
class TcpTransportServerServiceCollectionExtensions
public static class TcpTransportServerServiceCollectionExtensions
Extension methods for registering the server side of the TCP transport.
Members
| Member | Kind | Summary |
|---|---|---|
AddTcpTransportServer( | extension method | Adds TCP transport server services to the service collection. |
extension method AddTcpTransportServer(IServiceCollection, Action<TcpTransportOptions>) #
AddTcpTransportServer(IServiceCollection, Action<TcpTransportOptions>) #public static IServiceCollection AddTcpTransportServer(this IServiceCollection services, Action<TcpTransportOptions>? configure = null)
Adds TCP transport server services to the service collection.
Parameters
services: The service collection.configure: Optional configuration action.
Returns
The service collection.