ID:               35062
 User updated by:  dima at dimych dot sumy dot ua
 Reported By:      dima at dimych dot sumy dot ua
 Status:           Bogus
 Bug Type:         Sockets related
 Operating System: FreeBSD 4.9-STABLE #0
 PHP Version:      4.4.1RC1
 New Comment:

I`m not agree what it is bogus....

part of code from ext/sockets/sockets.c:
-- code --
if (type == PHP_NORMAL_READ) {
                retval = php_read(php_sock->bsd_socket, tmpbuf, length,
0);
        } else {
                retval = recv(php_sock->bsd_socket, tmpbuf, length,
0);
        }

        if (retval == -1) {
                PHP_SOCKET_ERROR(php_sock, "unable to read from
socket", errno);
                efree(tmpbuf);
                RETURN_FALSE;
        }
-- end of code --
As you can see any processing for EAGAIN not exists. Warning will be
generated in any case. 

1. I`m developing icmp ping function and "no reply" is not an error in
my program.
2. Function, what can say is any data to receive, not exists.
3. I do not want to turn warnings off. Because I need them in other
places.


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

[2005-11-02 14:18:22] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.



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

[2005-11-02 08:52:06] dima at dimych dot sumy dot ua

Description:
------------
Use of socket_read() on non blocking sockets produces warinigs like:
socket_read() unable to read from socket [35]: Resource temporarily
unavailable

I`m storing all php errors in log file /var/log/php.log.
This warning causes overflow of /var partition because socket_read()
called to wait icmp message. 


Reproduce code:
---------------
$socket = socket_create(AF_INET, SOCK_RAW, 1);
socket_connect($socket, $host, null);
$startTime = microtime_float(true);
socket_send($socket, $data, strLen($data), 0);
socket_set_nonblock($socket);
while((microtime_float() - $startTime) < 0.5) {
  $mt = microtime_float();
  if (socket_read($socket, 255)) {
     break;
  }
}
socket_close($socket);


Expected result:
----------------
no warnings in php.log

Actual result:
--------------
I`m receive huge count of warinigs in my php.log file like this:
socket_read() unable to read from socket [35]: Resource temporarily
unavailable



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


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

Reply via email to