telnet problem

ok, i need to test a list of addresses via telnet and make sure that i get a response like the following:

telnet anag.testboalo.com443

Trying 100.100.100.100...
Connected to anag.testboalo.com.
Escape character is '^]'.

The thing is, for each address I telnet to, the telnet hangs in there until I exit out of it with a control-C. Is there away to script this so that it doesn't just sit there waiting for user intervention?

I would need to script this. So i need a way to telnet to all the addresses and have the telnet exit out of the session itself and go on to the next.

Any help on this will be appreciated. Thank you very much.

This should get you out of telnet

while read ipaddress
do
telnet $ipaddress <<EOF
close
EOF
done < addressfile > logfile

Examine logfile for problems

Use nmap ie:

# nmap -p23 <range of hosts>

this look like it could do the job. but it's not working.

this is my code:

while read line


do


	telnet $line $PORT <<EOF
	close
	EOF>>


done

the above code fails with a:

./telnet_connectivity.sh: 17: Syntax error: end of file unexpected (expecting "done")

Hello ,
I think you only want to check whether the host is up or not.

while read ip
do 
ping -c 3 $ip
done<ip_file.txt

if you put the ip addresses in the file ip_file.txt