#32184 [Fbk->NoF]: I think it's the socket daemon script 's bug
| From: | php-bugs at lists dot php dot net | Date: | Sat, 12 Mar 2005 00:00:12 +0000 |
| Subject: | #32184 [Fbk->NoF]: I think it's the socket daemon script 's bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76961@lists.php.net to get a copy of this message | ||
ID: 32184
Updated by: php-bugs@lists.php.net
Reported By: huoqi29 at 163 dot com
-Status: Feedback
+Status: No Feedback
Bug Type: Sockets related
Operating System: Linux DevelopWeb 2.6.8-24-smp #1
PHP Version: 5.0.3
New Comment:
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".
Previous Comments:
------------------------------------------------------------------------
[2005-03-04 11:32:12] tony2001@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
Can't reproduce.
Please explain more clearly - what do you expect and what do you get.
------------------------------------------------------------------------
[2005-03-04 09:09:33] huoqi29 at 163 dot com
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
------------------------------------------------------------------------
[2005-03-04 09:02:30] huoqi29 at 163 dot com
Description:
------------
If you uncomment the '//echo "Bug";' and when you run this script
,you will get the expect result if you don't logout, and when you login
and "ps -aux " you can find it.
But where you "telnet 127.0.0.1 99999" you can't connect it .
Reproduce code:
---------------
<?php
if(pcntl_fork()){exit;} posix_setsid(); chdir("/"); umask(0);
$sock=socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
socket_bind($sock,"127.0.0.1",99999);
socket_listen($sock); $R=array($sock);
while(1) { $T=$R; if($C=socket_select($T,$W=NULL,$E=NULL,0,0)) {
foreach($T as $sock2) {
if($sock2==$sock) {
$client=socket_accept($sock);
array_push($R,$client);
}
else{ //echo "Bug";
//socket_getpeername($sock2,&$add,&$prot);
$B=socket_recv($sock2,$Buf,1024,0);
if($B==0 || chop($Buf)=="quit" ||
chop($Buf)=="exit") {
$I=array_search($sock2,$R);
unset($R[$I]);
socket_close($sock2);
}else socket_send($sock2,"Hello".$Buf,1024,0);
} } } } ?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32184&edit=1