an idea from me - if you have netcat installed use :
nc -z server.com 21
the response should be :
Quote:
|
Connection to server.com 21 port [tcp/ftp] succeeded!
|
then echo $? will return 0, on failure will return 1. Check the error code and proceed based on the response.
-z flag just checks for a live listener / daemon on the remote port, without sending the data. This should ensure that the connection is OK.