matthew016
asked on
Port is down
Hi,
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.
<?php
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>");
else
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");
else
echo ( "port $port is down on $ip");
}
?>
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.
<?php
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>");
else
echo (" your server $ip is currently down :(<br><br>");
/*Test port*/
if ($port && $ping_check==0)
{
echo (" Testing port...<br>");
$portcheck=exec('/usr/bin/
if ($portcheck!="")
echo ( "port $port is open on $ip");
else
echo ( "port $port is down on $ip");
}
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am on Windows.
Anyway I am sure you have other tools to check if a port is available.