From:             dmitrysp at yandex dot ru
Operating system: Windows XP
PHP version:      5.1.6
PHP Bug Type:     Sockets related
Bug description:  8Kb write buffer on nonblock sockets

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
&#1054;&#1087;&#1077;&#1088;&#1072;&#1094;&#1080;&#1103; 
      // &#1085;&#1072;
&#1085;&#1077;&#1079;&#1072;&#1073;&#1083;&#1086;&#1082;&#1080;&#1088;&#1086;&#1074;&#1072;&#1085;&#1085;&#1086;&#1084;
&#1089;&#1086;&#1082;&#1077;&#1090;&#1077; &#1085;&#1077;
&#1084;&#1086;&#1078;&#1077;&#1090; &#1073;&#1099;&#1090;&#1100;
&#1079;&#1072;&#1074;&#1077;&#1088;&#1096;&#1077;&#1085;&#1072;
&#1085;&#1077;&#1084;&#1077;&#1076;&#1083;&#1077;&#1085;&#1085;&#1086;.
    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 bug report at http://bugs.php.net/?id=39068&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39068&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39068&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39068&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39068&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=39068&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39068&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39068&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39068&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39068&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39068&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=39068&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=39068&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39068&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39068&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39068&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39068&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39068&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39068&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39068&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39068&r=mysqlcfg

Reply via email to