#21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
From: tommyo at gmail dot com Date: Thu, 29 Sep 2005 14:07:36 +0000 Subject: #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ References: 1 Groups: php.bugs Request: Send a blank email to php-bugs+get-85775@lists.php.net to get a copy of this message
ID: 21197
Comment by: tommyo at gmail dot com
Reported By: bool at boolsite dot net
Status: No Feedback
Bug Type: Sockets related
Operating System: win32 only
PHP Version: 5.*, 4.*
New Comment:
I installed the latest windows build PHP Version 5.1.0RC2-dev and the
socket problem still exists. I get:
Warning: socket_read() [function.socket-read]: unable to read from
socket [0]: The operation completed successfully.
When I put PHP_NORMAL_READ for the read type parameter. Using the
default or PHP_BINARY_READ works just fine for the same line of code.
Previous Comments:
------------------------------------------------------------------------
[2005-09-29 01:00:25] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2005-09-21 12:46:05] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2004-03-11 11:06:02] nlopess@php.net
I've compilled PHP with cygwin/gcc and no error is produced. However,
the build version from snaps.php.net gives that error.
------------------------------------------------------------------------
[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);
?>
------------------------------------------------------------------------
[2002-12-26 20:39:22] edink@php.net
If you omit the third parameter to socket_read() it seems to work fine.
However, adding PHP_NORMAL_READ causes error as described in the bug
report.
------------------------------------------------------------------------
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 (#85775) | next » |
|---|