#46172 [Opn->Bgs]: fwrite refuses to write more then 32k to non-blocking socket
| From: | scottmac@php.net | Date: | Thu, 25 Sep 2008 11:45:34 +0000 |
| Subject: | #46172 [Opn->Bgs]: fwrite refuses to write more then 32k to non-blocking socket | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-129246@lists.php.net to get a copy of this message | ||
ID: 46172
Updated by: scottmac@php.net
Reported By: php at 3r1c dot eu
-Status: Open
+Status: Bogus
Bug Type: Streams related
Operating System: FreeBSD
PHP Version: 5.2.6
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
The default tcp socket send buffer on FreeBSD is 32k, you need to
change net.inet.tcp.sendspace to a higher value if you want to write
more.
Previous Comments:
------------------------------------------------------------------------
[2008-09-25 11:34:58] php at 3r1c dot eu
Description:
------------
fwrite refuses to write more then 32k to non-blocking socket.
removing the stream_set_blocking line in my sample code will make the
program work properly.
It seems to get higher amount written on a localhost socket, about
120kb.
Reproduce code:
---------------
#!/usr/local/bin/php -q
<?php
// create a string with 100kb of zeros
$bytes = "";
for ($i = 0; $i < 100000; $i++){
$bytes .= "0";
}
$sock = @stream_socket_client('tcp://google.com:80', $errno, $errstr,
30);
stream_set_blocking($sock, 0);
$written = fwrite($sock, $bytes);
echo "Wrote $written bytes\n";
fclose($sock);
?>
Expected result:
----------------
Wrote 100000 bytes
Actual result:
--------------
Wrote 32768 bytes
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46172&edit=1