Port is down

Posted on 2007-08-01
Last Modified: 2010-04-20

I am trying from my website host to connect from a flash application to a java server on another machine (my machine).
I can connect locally, but from the website host it is not possible to connect.

I tried the script in php below :
It says server is running but port is down.

Maybe you can try yourself ?
my ip :
port of java program : 5000

It must be available because I activated DMZ on my router.

So I tried to run the script on the web hosting server and locally,
both it says that port 5000 is down ...
really weird because locally I can connect to 5000 java server.
Maybe script not working well or I didn't understand something.

echo (" Testing server...<br>");
$ip=""; /* mettez ici l'adresse que vous voulez comme ip à tester*/
$port="5000"; /* mettez ici le port que vous vouez (ou rien si vous voulez juste pinguer..)*/

/*test ping*/
$ping_check=exec ('/bin/ping -c2 -q -w2 '.$ip.' | grep transmitted | cut -f3 -d"," | cut -f1 -d"," | cut -f1 -d"%"');
if ($ping_check==0)
    echo ("your server $ip  is currently up :)<br><br>");
    echo (" your server $ip is currently down :(<br><br>");

/*Test port*/
if ($port && $ping_check==0)
    echo (" Testing port...<br>");
    $portcheck=exec('/usr/bin/nmap -p '.$port.' --host_timeout=2500 '.$ip.'| grep '.$port.'/tcp | cut -f1 -d"/"');
    if ($portcheck!="")
        echo ( "port $port is open on $ip");
        echo ( "port $port is down on $ip");
Question by:matthew016
    LVL 9

    Author Comment

    Maybe I need a Unix machine to make this script work well,
    I am on Windows.

    Anyway I am sure you have other tools to check if a port is available.
    LVL 19

    Accepted Solution

    I checked the port it is definetly need to be on a unix machine to make this script work, cut and grep are *nix commands...check the dmz settings on your router ..and of course you need to check the firewall settings on the machine that has the application that works on port 5000..and you should check if the port is only listening locally or on all interfaces.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Is your computer hacked? learn how to detect and delete malware in your PC
    David Varnum recently wrote up his impressions of PRTG, based on a presentation by my colleague Christian at Tech Field Day at VMworld in Barcelona. Thanks David, for your detailed and honest evaluation!
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now