isHostReachable method
Ping a single address. See AwsConnectionOption for more information about the accepted argument.
Implementation
Future<AwsConnectionResult> isHostReachable(
AwsConnectionOption option) async {
Socket? socket;
try {
socket = await Socket.connect(
option.address,
option.port,
timeout: option.timeout,
);
socket.destroy();
return AwsConnectionResult(option, true);
} catch (e) {
socket?.destroy();
return AwsConnectionResult(option, false);
}
}