On Thu, 16 May 2024, at 3:35 AM, Peng Yu wrote:
> Hi,
>
> When a host is on, but a port is not on, exec commands like the
> following will take some time before it returns. How can I control the
> timeout so that it returns earlier if the port is nonresponsive?
> Thanks.
>
> $ time exec {fd}</dev/tcp/google.com/8242
> -bash: connect: Operation timed out
> -bash: /dev/tcp/google.com/8242: Operation timed out
>
> real 1m15.055s
> user 0m0.001s
> sys 0m0.004s
Your options are as follows.
- use a more capable external utility to set up and interact with sockets
- use a more powerful programming language
- compile and use a modified bash shell
--
Kerin Millar