[PHP-DEV] Bug #14578 Updated: socket_read() behavior

2002-01-28 Thread sterling

ID: 14578
Updated by: sterling
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: Sockets related
Operating System: Windows 2000
PHP Version: 4.1.0
New Comment:

This is not a php issue, this is either a winsock or programmer issue. 
The fact that socket_read() returns correctly, means that socket_read()
is correct (cause all we do is map socket_read() to a recv() call).


Previous Comments:


[2001-12-18 08:37:29] [EMAIL PROTECTED]

Hm in my last example there should be 
--
$cnt = 0;
do {
$row = socket_read($irc, 1027, PHP_BINARY_READ);
$cnt .= strlen($row);
if (strlen($row)  1027) break;
}
echo $cnt bytes read;
--

of course, not 1028 :)



[2001-12-18 08:35:37] [EMAIL PROTECTED]

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 this bug report at http://bugs.php.net/?id=14578edit=1


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #14578 Updated: socket_read() behavior

2001-12-18 Thread martin

ID: 14578
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Sockets related
Operating System: Windows 2000
PHP Version: 4.1.0
New Comment:

Hm in my last example there should be 
--
$cnt = 0;
do {
$row = socket_read($irc, 1027, PHP_BINARY_READ);
$cnt .= strlen($row);
if (strlen($row)  1027) break;
}
echo $cnt bytes read;
--

of course, not 1028 :)

Previous Comments:


[2001-12-18 08:35:37] [EMAIL PROTECTED]

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 this bug report at http://bugs.php.net/?id=14578edit=1


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]