#21197 [Asn->Fbk]: socket_read() outputs error with PHP_NORMAL_READ
From: sniper@php.net Date: Wed, 25 Feb 2004 23:38:44 +0000 Subject: #21197 [Asn->Fbk]: socket_read() outputs error with PHP_NORMAL_READ References: 1 Groups: php.bugs Request: Send a blank email to php-bugs+get-55574@lists.php.net to get a copy of this message
ID: 21197
Updated by: sniper@php.net
Reported By: bool at boolsite dot net
-Status: Assigned
+Status: Feedback
Bug Type: Sockets related
Operating System: win32 only
PHP Version: 4CVS
Assigned To: wez
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Bug #21760 was fixed, and it's pretty likely this is the same issue.
Previous Comments:
------------------------------------------------------------------------
[2004-01-10 20:30:41] sniper@php.net
Assigning to Wez who might know why streams are borked.
------------------------------------------------------------------------
[2003-12-15 11:11:42] nunoplopes at sapo dot pt
I'm using latest snapshot and I have the same problem. With
PHP_BINARY_READ everything works but with PHP_NORMAL_READ I receive the
following error:
"Warning: socket_read() unable to read from socket [0]: The operation
completed s
uccessfully."
------------------------------------------------------------------------
[2003-08-26 02:00:58] bool at boolsite dot net
Ok, this is a short example : (a little echo server)
<?php
error_reporting(E_ALL);
$Port=6669;
if(($Sock=socket_create(AF_INET,SOCK_STREAM,0))<=0) {
echo 'socket_create() a échoué :
',socket_strerror(socket_last_error($Sock)),"\r\n";
exit;
}
if(($Ret=socket_bind($Sock,0,$Port))<=0) {
echo 'socket_bind() a échoué :
',socket_strerror(socket_last_error($Ret)),"\r\n";
exit;
}
if(($Ret=socket_listen($Sock,5))<=0) {
echo 'socket_listen() a échoué :
',socket_strerror(socket_last_error($Ret)),"\r\n";
exit;
}
while(true){
$MsgSock=socket_accept($Sock);
if($MsgSock===false) {
echo 'socket_accept() a échoué :
',socket_strerror(socket_last_error($MsgSock)),"\r\n";
break;
}
else {
echo '=> Debut de la connexion...',"\r\n";
$EndTime=time()+15;
do{
$buffer=socket_read($MsgSock,1024,PHP_NORMAL_READ);
if($buffer===false) {
echo 'socket_read() a échoué :
',socket_strerror(socket_last_error($MsgSock)),"\r\n";
break;
}
elseif(!$buffer){
continue;
}
$buffer=trim($buffer);
echo '< ',$buffer,"\r\n";
if($buffer=='quit') {
break;
}
$back='You sent : ['.$buffer.']';
echo '> ',$back,"\r\n";
socket_write($MsgSock,$back."\r\n");
} while(time()<$EndTime);
@socket_close($MsgSock);
echo '=> End...',"\r\n";
}
}
socket_close($Sock);
?>
------------------------------------------------------------------------
[2003-08-25 20:17:06] sniper@php.net
Please provide a complete but short example script that can be used to
reproduce this bug.
------------------------------------------------------------------------
[2003-08-25 18:19:27] bool at boolsite dot net
It's not the same bugs than http://bugs.php.net/bug.php?id=21760 . Here
it's a Win32 PHP version bug only, since the PHP 4.3.0 version, and
there is always the bug in the last version 4.3.3.
socket_read() always return FALSE, and display this error : "erreur [0]
avec socket_read : OpÚration rÚussie."
(in english it should be "error [0] with socket_read : operation
completed.")
maybe it's because of the socket_select() before the socket_read() ?
PS : it affects all my codes, but only with PHP 4.3.x Win32 version. On
unix or with PHP 4.2.3 all works fine.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/21197
--
Edit this bug report at http://bugs.php.net/?id=21197&edit=1
Thread (46 messages)
- #21197 [Opn->Ver]: socket_read() seems to doesn't work
- #21197 [Com]: socket_read() seems to doesn't work
- #21197 [Ver->Ana]: socket_read() seems to doesn't work
- #21197 [Com]: socket_read() seems to doesn't work
- #21197 [Ana->Bgs]: socket_read() seems to doesn't work
- #21197 [Bgs]: socket_read() seems to doesn't work
- #21197 [Bgs->Opn]: socket_read() seems to doesn't work
- #21197 [Opn->Fbk]: socket_read() seems to doesn't work
- #21197 [Fbk->Opn]: socket_read() seems to doesn't work
- #21197 [Com]: socket_read() seems to doesn't work
- #21197 [Opn->Ver]: socket_read() seems to doesn't work
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Ver->Fbk]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Fbk->NoF]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [NoF->Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn->Asn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Asn->Fbk]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Fbk->Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn->Asn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Asn->Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn->Fbk]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [NoF->Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn->Fbk]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Fbk->Ver]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Ver->Asn]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Asn]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Asn]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Asn->Csd]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
| « previous | php.bugs (#55574) | next » |
|---|