Bug #14578: socket_read() behavior

From: Date: Tue, 18 Dec 2001 13:35:38 +0000
Subject: Bug #14578: socket_read() behavior
Groups: php.dev 
Request: Send a blank email to php-dev+get-74248@lists.php.net to get a copy of this message
From: martin@humany.com Operating system: Windows 2000 PHP version: 4.1.0 PHP Bug Type: Sockets related Bug description: socket_read() behavior I call socket_read() like this: $data = socket_read($handle, 80, PHP_BINARY_READ); and get 80 byte back. i made a loop to continue read until strlen($data) < 80 (just experimenting): -- $cnt = 0; do { $row = socket_read($irc, 80, PHP_BINARY_READ); $cnt .= strlen($row); if (strlen($row) < 80) break; } echo "$cnt bytes read"; -- This gives me 1027 bytes of data, even though there is more data left to read, the last read only returns 67 bytes of data. if i call socket_read() with 2048 as size, i also only get 1027 bytes back So i worked around this in my example loop like this: $cnt = 0; do { $row = socket_read($irc, 1028, PHP_BINARY_READ); $cnt .= strlen($row); if (strlen($row) < 1028) break; } echo "$cnt bytes read"; Wich works, and reads everything for me. But is this really the expected behaviour? -- Edit bug report at: http://bugs.php.net/?id=14578&edit=1

« previous php.dev (#74248) next »