#37721 [Opn->Fbk]: socket_recv() don't returns expected value when useing some flags
ID: 37721
Updated by: tony2001@php.net
Reported By: krzycho at wapp dot pl
-Status: Open
+Status: Feedback
Bug Type: Sockets related
Operating System: FreeBSD 5.4-R
PHP Version: 4.4.2
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.
We need BOTH expected *AND* actual results.
Previous Comments:
------------------------------------------------------------------------
[2006-06-06 22:43:22] krzycho at wapp dot pl
ex:
when packet was send by:
socket_send ( resource socket, string buf, 1500, int flags )
real packet size will be 1500, and when we receive data return value
should be that 1500 insend of that we currentlty read 1024... and we
cound know that when we read again we got same packet.
linux man 2 recv:
MSG_TRUNC
Return the real length of the packet, even when it was longer
than the passed buffer. Only valid for packet sockets.
i think it's enough example...
------------------------------------------------------------------------
[2006-06-06 22:20:47] tony2001@php.net
Care to add expected and actual results?
------------------------------------------------------------------------
[2006-06-06 22:13:21] krzycho at wapp dot pl
Description:
------------
some flags don't work correctly, cause returned value is not value
returned by the recv() function...
some flags work correct(ex. MSG_PEEK), cause it don't modify value
returned by the recv.
sockets.c (line 322): m = recv(bsd_socket, (void *) t, 1, flags);
sockets.c (line 341): return n;
should be when we use some flags: return m;
Reproduce code:
---------------
define("MSG_OOB", 1);
define("MSG_PEEK", 2);
define("MSG_DONTROUTE", 4);
define("MSG_EOR", 8);
define("MSG_TRUNC", 16);
define("MSG_CTRUNC", 32);
define("MSG_WAITALL", 64);
$flag=socket_recv($read, $data, 1024, MSG_TRUNC);
echo $flag;
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37721&edit=1
Thread (6 messages)