ID:               32324
 Updated by:       php-bugs@lists.php.net
 Reported By:      admin at freeworldonline dot com
-Status:           Feedback
+Status:           No Feedback
 Bug Type:         Sockets related
 Operating System: Linux stripples.devel.redhat.com
 PHP Version:      4.3.10
 New Comment:

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".


Previous Comments:
------------------------------------------------------------------------

[2005-03-16 00:19:11] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

I can not reproduce this. I get only "Message from 127.0.0.1:52345
(363/363 bytes)..." 


------------------------------------------------------------------------

[2005-03-15 20:19:07] admin at freeworldonline dot com

Description:
------------
I am trying to recieve data via a UDP socket using the socket_recvfrom
function. It works fine unless there is a null char anywhere in the
packet.

If there is the buffer returned only contains data up to that point,
although the value returned by the function shows there is actually
more data.

Reproduce code:
---------------
if (!$sock=socket_create(AF_INET,SOCK_DGRAM,SOL_UDP)) {
        echo "<b>Error:</b> Failed to create socket,
".socket_strerror(socket_last_error($sock))."<br>\n";
        } elseif (!socket_bind($sock,"0.0.0.0",41330)) {
        echo "<b>Error:</b> Failed to bind socket,
".socket_strerror(socket_last_error($sock))."<br>\n";
        socket_close($sock);
        } else {
        echo "<b>Ready, please send a message to port 41330 using
UDP</b><br><br>\n";
        
        $size=socket_recvfrom($sock,$buf,65535,0,$clientIP,$clientPort);
        if ($buf===FALSE) {
                echo "<b>Error:</b> Returned false,
".socket_strerror(socket_last_error($sock))."<br>\n";
                } else {
                echo "Message from ".$clientIP.":".$clientPort."
(".strlen($buf)."/".$size." bytes)...<br>\n";
                }
        
        socket_close($sock);
        }

Expected result:
----------------
All data to be placed into the buffer regardless of any null characters
in the packet.

Actual result:
--------------
If you send a datagram to port 41330 while this is running with a null
character mid way into the packet, any data from there onwards will not
be placed into $buf.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32324&edit=1

Reply via email to