• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

Port is down


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 : mathi.hopto.org
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="mathi.hopto.org"; /* 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");
1 Solution
matthew016Author Commented:
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.
http:// thevpn.guruCommented:
I checked the port it is down..you 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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now