Hello,
I need to check if a user has properly open his port on his computer. He
will call a script specifing the port he want to use and the script will
have to check if he can open a socket on the IP:Port.
Here is a what I have tried but it doesn't work, even if the port is
properly open :
-----------------------------Script ------------------
<?php
ob_implicit_flu sh();
if (($sock = socket_create(A F_INET, SOCK_STREAM, SOL_TCP)) < 0)
{
die("socket_cre ate() failed : " . socket_strerror ($sock) . "\n");
}
if (($ret = socket_connect( $sock, $address, $port)) < 0)
{
die("socket_con nect() failed : raison : " . socket_strerror ($ret) .
"\n");
}
echo "connected\ n";
socket_close($s ock);
?>
-------------------------End Script ---------------------
Any suggestions ? Thanks in advance.
Fred.
I need to check if a user has properly open his port on his computer. He
will call a script specifing the port he want to use and the script will
have to check if he can open a socket on the IP:Port.
Here is a what I have tried but it doesn't work, even if the port is
properly open :
-----------------------------Script ------------------
<?php
ob_implicit_flu sh();
if (($sock = socket_create(A F_INET, SOCK_STREAM, SOL_TCP)) < 0)
{
die("socket_cre ate() failed : " . socket_strerror ($sock) . "\n");
}
if (($ret = socket_connect( $sock, $address, $port)) < 0)
{
die("socket_con nect() failed : raison : " . socket_strerror ($ret) .
"\n");
}
echo "connected\ n";
socket_close($s ock);
?>
-------------------------End Script ---------------------
Any suggestions ? Thanks in advance.
Fred.
Comment