ID:               20317
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Feedback
+Status:           No Feedback
 Bug Type:         Sockets related
 Operating System: Redhat Linux 7.3
 PHP Version:      4.2.1
 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.




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

[2002-11-08 12:28:53] [EMAIL PROTECTED]

Please try using this CVS snapshot:

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

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

[2002-11-08 12:24:35] [EMAIL PROTECTED]

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 46080 bytes) in /usr/local/apache/htdocs/login.php on line 88,
which is the line with socket_sendto()

Here is the code:
Basically it sends a UDP request to authmsgque service,
and expect it receive some response back.

    $address = gethostbyname ('localhost');
    $service_port = getservbyname ('authmsgque', 'udp');

    /* Create a TCP/IP socket. */
    $socket = socket_create (AF_INET, SOCK_DGRAM, 0);
    if ($socket < 0) {
//        echo "socket_create() failed: reason: " . socket_strerror
($socket) . "<br>\n";
    } else {
//        echo "socket_create() OK.<br>\n";
    }

//    echo "Attempting to connect to '$address' on port
'$service_port'...<br>\n";

    $outbuf = "abc+++cde";

    for ($i = 1; $i <= 3; $i++) {
        $result = socket_sendto ( $socket, $outbuf, strlen($outbuf), 0,
$address , $service_port );
        if ($result < 0) {
//            echo "socket_sendto() failed.\nReason: ($result) " .
socket_strerror($result) . "<br>\n";
        } else {
//            echo "socket_sendto() OK.<br>\n";
        }

        $inbuf = "NO RESPONSE";
        $remote_address = "abc";
        $remote_port = 100;

        echo "Reading response:<br>\n\n";
        $result2 = 0;

        /* Prepare the read array */
        $read = array($socket);

        if (false == ($num_changed_sockets = socket_select($read,
$write = NULL, $except = NULL, 5)))
            /* Error handling */
            ;
//            echo "socket_select() failed.\nReason: timeout <br>\n";
        else if ($num_changed_sockets > 0) {
            /* At least at one of the sockets something interesting
happened */
            $result2 = socket_recvfrom ( $socket, $inbuf, 1024, 0,
$remote_address, $remote_port );
//            echo "result2 : ".$result2."<br>\n";
//            echo "remote_address : ".$remote_address."<br>\n";
//            echo "remote_port : ".$remote_port."<br>\n";
//            echo "received buffer : ".$inbuf."<br>\n";
            if ( $result2 > 0 && strcmp($inbuf,"NO RESPONSE") != 0 )
                break;
        }
    }
    socket_close ($socket);

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


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

Reply via email to