Telnet Timeout

is there a way to add a timeout parameter to telnet when connecting to any IP address?

like, if this IP doesn't respond within 10 seconds, abort.

thanks

i'm looking for something like this:

telnet gaggaga.com 443 -t 10

so telnet doesn't have a command line timeout parameter?

Correct

If you have expect you could implement something like this:

#!/usr/bin/expect --

set timeout [lindex $argv 0] 
set machine [lindex $argv 1]

spawn telnet $machine

expect {
  "ogin" interact
  timeout  exit 
  }

The use it like this:

./script_name <timeout> <hostname>