The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > IP Networking
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 04-24-2008
sysgate's Avatar
sysgate sysgate is offline
Unix based
 

Join Date: Nov 2006
Location: /root
Posts: 1,163
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.
Reply With Quote