On Sun, Jun 25, 2006 at 05:41:42PM +1000, atstake atstake wrote: > I am probing a host using OpenBSD 3.9-release's netcat. > > # nc -v -w 3 -z host.com 80-81 > > If it finds port 80 open and 81 closed it sits there in an endless > loop for about 1 minute and 10 seconds and after that it gives a > connection time-out error. > > # nc -v -w 3 -z host.com 80-81 > > Connection to host.com 80 port [tcp/www] succeeded! > nc: connect to host.com port 81 (tcp) failed: Connection timed out > > there is no firewall blocking either end of the connection. > > How can I make this timeout a bit faster? I am already telling it to > bail out after 3 seconds with ( -w 3 ) but seems like it is not helping.
The man page says that -w stops nc after a certain amount of inactivity; *not* if the link doesn't come up within this time. nc doesn't appear to have an option for this; the canonical tool is net/nmap, which works well. Joachim