Shell/Bash script telnet testing a multicast address -
i trying create shell/bash script telnet test multicast address. have following:
telnet <ip_address> <port_number>
however, hangs:
<server_name>% ./telnet_test.sh trying <ip_address>... connected <ip_address>. escape character '^]'. //hangs here few seconds... connection <ip_address> closed foreign host.
how can test multicast address , return if successful not have wait until connection closed foreign host.
i need test multiple addresses in same script.
edit:
i should have mentioned on bank network tightly controlled firewalls , cannot have netcat installed.
the purpose of test see if can connection route current host.
use netcat
instead.
-z
- scan listening daemons.
-w 3
- timeout after 3 seconds
#!/bin/bash host_list="www.google.com www.stackoverflow.com" port=80 host in $host_list; nc -z -w 3 $host $port > /dev/null 2>&1 if [[ $? = 0 ]]; printf "%s%s%s\n" " [$host:" "up" "]" else printf "%s%s%s\n" " [$host:" "down" "]" fi done
Comments
Post a Comment