|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-09-25 11:45 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 03:00:02 2025 UTC |
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