Table of Contents

Class TcpHealthChecker

Namespace
AppHealthMonitor
Assembly
AppHealthMonitor.dll

Checks port health by attempting to establish a TCP connection. Uses a linked cancellation token to enforce timeouts without leaking timers.

public sealed class TcpHealthChecker : IHealthChecker
Inheritance
TcpHealthChecker
Implements
Inherited Members

Properties

PortType

Gets the port type this health checker handles.

public PortType PortType { get; }

Property Value

PortType

Methods

IsResponsiveAsync(string, int, int, CancellationToken)

Checks if the specified port is responsive.

public Task<bool> IsResponsiveAsync(string host, int port, int timeoutMilliseconds, CancellationToken cancellationToken)

Parameters

host string

The hostname or IP address to check.

port int

The port number to check.

timeoutMilliseconds int

The timeout in milliseconds before the check is considered failed.

cancellationToken CancellationToken

Token to signal cancellation of the check.

Returns

Task<bool>

True if the port is responsive; otherwise, false.