ID: 43695
Comment by: protosss_3R453_M3_ at gmail dot com
Reported By: nicolas dot legland at free dot fr
Status: Open
Bug Type: Streams related
Operating System: Windows XP Professional SP2
PHP Version: 5.3CVS-2007-12-28 (snap)
New Comment:
With Win XP:
-- Ver --
PHP 5.2.5 (cli) (built: Nov 8 2007 23:18:51)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
-- Sockets --
Open 0.279610
Wait 1.593794
read 0, write 0, except
Close 0.000032
-- Stream --
Open 0.005327
Wait 1.701860
read 0, write 0, except
Close 0.499333
Previous Comments:
------------------------------------------------------------------------
[2007-12-28 15:32:40] rotoclapp at free dot fr
With Windows XP
Stream
------
Open 0.092821
Wait 1.586471
Close 0.409261
read 0, write 0, except 1
Sockets
-------
Open 0.002044
Wait 1.661001
Close 0.000029
read 0, write 0, except 1
------------------------------------------------------------------------
[2007-12-28 15:01:57] nicolas dot legland at free dot fr
$ uname -imprs
FreeBSD 6.2-STABLE i386 i386 GENERIC
$ php -version
PHP 5.2.4 with Suhosin-Patch 0.9.6.2 (cli) (built: Oct 17 2007
15:51:03)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
$ php -f socket.php
Open 0.002772
Wait 0.166301 read 1, write 1, except 0
Close 0.000177
$ php -f stream.php
Open 0.002527
Wait 0.166407 read 1, write 1, except 0
Close 0.000164
------------------------------------------------------------------------
[2007-12-28 14:57:52] xrogaan at gmail dot com
Works on linux ubuntu 7.10.
Stream
------
$ php -f stream.php
Open 0.033060
Wait 0.186314 read1, write 1, except0
Close 0.000088
Socket
------
$ php -f socket.php
Open 0.017214
Wait 0.186275 read1, write 1, except0
Close 0.000077
$ php -v
PHP 5.2.3-1ubuntu6.2 (cli) (built: Dec 3 2007 19:57:39)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with Suhosin v0.9.20, Copyright (c) 2002-2006, by Hardened-PHP
Project
------------------------------------------------------------------------
[2007-12-28 14:17:55] koollman at gmail dot com
Works fine on linux, so it may be windows related:
#socket example, edited to remove the dl() call
$ php5 socket.php
Open 0.002049
Wait 0.194022 read
1, write 1, except
0
Close 0.000044
#stream example
$ php5 stream.php
Open 0.007108
Wait 0.211123 read
1, write 1, except
0
Close 0.000048
#php5 from http://hype.sourceforge.jp
$ php5 --version
PHP 5.2.3-1~edh.0 (cli) (built: Jun 10 2007 11:07:12)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
#vanilla linux kernel
$ uname -r
2.6.22
------------------------------------------------------------------------
[2007-12-28 14:02:38] nicolas dot legland at free dot fr
Description:
------------
When using sockets through the "sockets" extension, everything works
fine with no delay to notice.
Reproduce code:
---------------
<?php
// Load socket extension
dl((('dll' === PHP_SHLIB_SUFFIX) ? 'php_' :
'').'sockets.'.PHP_SHLIB_SUFFIX);
// Send a [SYN] packet to scanme.nmap.org:70
$time = microtime(true);
$resource = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_set_nonblock($resource);
@socket_connect($resource, gethostbyname('scanme.nmap.org'), 70);
echo 'Open '.number_format((microtime(true) - $time), 6).PHP_EOL;
// Wait 3 seconds for a [SYN, ACK] packet
$time = microtime(true);
$read = $write = $except = array($resource);
socket_select($read, $write, $except, 3);
echo 'Wait '.number_format((microtime(true) - $time), 6).' read
'.count($read).', write '.count($write).', except
'.count($except).PHP_EOL;
// Cancel connection
$time = microtime(true);
socket_close($resource);
echo 'Close '.number_format((microtime(true) - $time), 6).PHP_EOL;
?>
Result:
-------
Open 0.030620
Wait 1.518440 read 0, write 0, except 1
Close 0.000108
------------------------------------------------------------------------
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/43695
--
Edit this bug report at http://bugs.php.net/?id=43695&edit=1