Sovket help?
| From: | shi | Date: | Mon, 24 Sep 2001 17:28:50 +0000 |
| Subject: | Sovket help? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-68573@lists.php.net to get a copy of this message | ||
Hi
I'm trying to listen to port 119 with a socket connection. The script looks
like this:
It works fine until this line "if(($ac=accept_connect($sock))<0){"
Thats where the problem is, it never accepts a connection it just keeps on
running.
<?
$sock = socket (AF_INET, SOCK_STREAM, 0);
$bin = bind($sock, '127.0.0.1', '119');
$lis = listen($sock, 4);
echo strerror($sock). "<BR>";
echo strerror($bin) . "<BR>";
echo strerror($lis). "<BR>";
if(($ac=accept_connect($sock))<0){
echo strerror($ac). "<BR>";
}
else
{
$str ='';
echo $ac;
$re =read($ac, $str, 10000);
}
echo strerror($re) . "<BR>";
echo $re . "<BR>";
?>
thanks
Shimon