ID: 39068
Updated by: [EMAIL PROTECTED]
Reported By: dmitrysp at yandex dot ru
-Status: Open
+Status: Bogus
Bug Type: Sockets related
Operating System: Windows XP
PHP Version: 5.1.6
New Comment:
Windows limitations are by no means PHP bugs.
Previous Comments:
------------------------------------------------------------------------
[2006-10-06 17:56:46] dmitrysp at yandex dot ru
Description:
------------
PHP on Windows can't write more 8192 bytes in nonblock mode socket (on
Linux or in blocked mode - no problems). And stream_set_write_buffer()
not work - buffer all time is only 8Kb.
About error 10035 in *.h files:
The network operation would block.
#define WINSOCK_WSAEWOULDBLOCK 0x00002733L
A non-blocking socket operation could not be completed immediately.
#define WSAEWOULDBLOCK 10035L
Reproduce code:
---------------
<?
error_reporting(E_ALL);
$f=fsockopen("www.php.net",80);
var_dump(stream_set_write_buffer($f,50000));// no effects, always
-1 on any size
stream_set_blocking($f,0);
$post=str_repeat('b',9000); // 7000 - work, 8192 or more not work
$str="POST / HTTP/1.0\r\n".
"HOST: www.php.net\r\n".
"Content-Type: application/x-www-form-urlencoded\r\n".
"Content-Length: ".strlen($post)."\r\n\r\n$post";
echo "fputs():\r\n".substr($str,0,1000)."\r\n";
fputs($f,$str);
// Notice: fputs(): send of 917 bytes failed with errno=10035
Операция
// на
незаблокированном
сокете не
может быть
завершена
немедленно.
while (!feof($f)) {
echo fread($f,100000);
sleep(1);
}
?>
Expected result:
----------------
I want use fputs() with big http-request and use nonblock fsockopen ;-)
Actual result:
--------------
fputs($f,$str); without notice and sockets bug on 8Kb buffer
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39068&edit=1