#37721 [Fbk->Opn]: socket_recv() don't returns expected value when useing some flags
| From: | krzycho at wapp dot pl | Date: | Tue, 06 Jun 2006 22:43:23 +0000 |
| Subject: | #37721 [Fbk->Opn]: socket_recv() don't returns expected value when useing some flags | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-98111@lists.php.net to get a copy of this message | ||
ID: 37721
User updated by: krzycho at wapp dot pl
Reported By: krzycho at wapp dot pl
-Status: Feedback
+Status: Open
Bug Type: Sockets related
Operating System: FreeBSD 5.4-R
PHP Version: 4.4.2
New Comment:
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...
Previous Comments:
------------------------------------------------------------------------
[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