Re: nc -w with -z does not seems to work.

2009-01-30 Thread Rajkumar S
2009/1/30 jared r r spiegel j...@ice-nine.org:

  check the obsd manpage, it is specifically different and does not mention
  connects:'

But nc -h gives

-w secs Timeout for connects and final net reads

So I guess obsd nc does not support timeouts for connect and will wait
1m15sec if host is not up?

raj



Re: nc -w with -z does not seems to work.

2009-01-30 Thread jared r r spiegel
On Fri, Jan 30, 2009 at 01:34:51PM +0530, Rajkumar S wrote:
 2009/1/30 jared r r spiegel j...@ice-nine.org:
 
   check the obsd manpage, it is specifically different and does not mention
   connects:'
 
 But nc -h gives
 
 -w secs Timeout for connects and final net reads

  yup, you're right.  other than the uppercase 'T' that's the same string
  as in the netcat i have on a debian system.  i'd guess that the obsd help()
  might just need an update to make it consistent with the manpage.

  it's possible that *i* am just misunderstanding the obsd nc(1), but in
  my experience, the timeout given by -w has nothing to do with connect
  timeouts.

 So I guess obsd nc does not support timeouts for connect and will wait
 1m15sec if host is not up?

  the wait is probably whatever the underlying network stack would normally
  have:

/home/jrrs $ time telnet 1.2.3.4 23
Trying 1.2.3.4...
telnet: connect to address 1.2.3.4: Connection timed out
1m15.03s real 0m0.01s user 0m0.00s system

-- 

  jared



Re: nc -w with -z does not seems to work.

2009-01-29 Thread jared r r spiegel
On Thu, Jan 29, 2009 at 12:26:21PM +0530, Rajkumar S wrote:

 Help says  -w is timeout for connects and final net reads, so nc should exit
 after 2 seconds, and it does exit when tested under linux, but not under
 openbsd.

  check the obsd manpage, it is specifically different and does not mention
  connects:'

---
 -w timeout
 If a connection and stdin are idle for more than timeout seconds,
 then the connection is silently closed.  The -w flag has no ef-
 fect on the -l option, i.e. nc will listen forever for a connec-
 tion, with or without the -w flag.  The default is no timeout.
---

  it is only for idles

 Am i doing some thing wrong or is this a bug in nc ?

  the gnu nc is different than the obsd one, even tho they're (iirc) both
  derived from the same source a while ago.

  the one in gnu land's -w option does what you want regarding connect
  timeouts.

  the openbsd one does not.

-- 

  jared



nc -w with -z does not seems to work.

2009-01-28 Thread Rajkumar S
Hi,

I am using Openbsd 4.4 GENERIC#1021 and nc to check if a port is open or
not. The command I use is

#  /usr/bin/nc -z -w 2 192.168.1.10  80

The command works fine if 192.168.1.10 is up, but if ip is non existing it
takes about 1m15sec to exit.

# time /usr/bin/nc -v  -z -w 2 192.168.3.96 80
nc: connect to 192.168.3.96 port 80 (tcp) failed: Connection timed out
1m14.99s real 0m0.00s user 0m0.00s system

Help says  -w is timeout for connects and final net reads, so nc should exit
after 2 seconds, and it does exit when tested under linux, but not under
openbsd.

Am i doing some thing wrong or is this a bug in nc ?

raj