set_socket_blocking($socket, False) doesn't work !
| From: | Greg Sovaridis | Date: | Sat, 08 Jul 2000 10:49:27 +0000 |
| Subject: | set_socket_blocking($socket, False) doesn't work ! | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-23860@lists.php.net to get a copy of this message | ||
I Guys,
I'm using PHP4.0.0 and try to connect to a home made application via TCP/IP
to send requests and get answers ...
It seems that the PHP function fputs is working fine because my daemon
application is receiving messages from the PHP script !
But the answer comming from the application is not received by the script.
I put a while loop like this :
$fp = fsockopen("localhost", "8000", &$errno, &$errstring, 3);
if(!$fp) {
echo "$errstr ($errno)<br>\n";
}
else {
set_socket_blocking($fp, False); // This is supposed to put the
socket to non blocking mode !
fputs($fp, $message); // Send something ...
while (!feof($fp)) { // Wait for the answer ...
$string .= fgets($fp, 60); // I also tried $string .=
fread($fp, 20);
}
}
It seems that the PHP engine if waiting for something even if I set the
socket to non Blocking !
If someone could help ... I will appreciate ...
Greg Sovaridis,
gs@tradeware.be