|
Posted by Boniface Frederic on 11/07/03 11:28
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_flush();
if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) < 0)
{
die("socket_create() failed : " . socket_strerror($sock) . "\n");
}
if (($ret = socket_connect($sock, $address, $port)) < 0)
{
die("socket_connect() failed : raison : " . socket_strerror ($ret) .
"\n");
}
echo "connected\n";
socket_close($sock);
?>
-------------------------End Script ---------------------
Any suggestions ? Thanks in advance.
Fred.
Navigation:
[Reply to this message]
|