Check if a local or remote port is reachable
This function attempts to connect to a specified port on a given host
within a specified timeout period. If the connection is successful, it resolves to true,
indicating that the port is reachable. If the connection fails or times out, it resolves to false.
Parameters
port: number
The port to check
host: string = 'localhost'
The host to check. Default localhost
timeout: number = 1000
The time to wait in milliseconds before giving up. Default 1000
Returns Promise<boolean>
A promise that resolves to true if the port is reachable, false otherwise.
Check if a local or remote port is reachable This function attempts to connect to a specified port on a given host within a specified timeout period. If the connection is successful, it resolves to true, indicating that the port is reachable. If the connection fails or times out, it resolves to false.