ID:               35062
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dima at dimych dot sumy dot ua
-Status:           Assigned
+Status:           Open
 Bug Type:         Sockets related
 Operating System: FreeBSD 4.9-STABLE #0
 PHP Version:      4.4.1RC1
 Assigned To:      nlopess
 New Comment:

After the reading the bug report carefully, the only problem here is
that socket_read() shouldn't produce a warning when errno==EAGAIN. The
return value of the function doesn't need/can't be changed.

The constant SOCKET_EAGAIN is already defined, so there's also a doc
bug :) (all SOCKET_* need to be documented)

The patch: http://mega.ist.utl.pt/~ncpl/php_bug_35062.txt


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

[2005-11-06 23:22:15] [EMAIL PROTECTED]

Nuno, since you seem to know the problem, feel free to fix it.

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

[2005-11-05 22:13:26] [EMAIL PROTECTED]

opening it again, as this seems a different issue.
We should have the EAGAIN constant and use it for non-blocking sockets.
returning false isnt't a good idea.

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

[2005-11-04 16:23:08] [EMAIL PROTECTED]

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #21197

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

[2005-11-04 14:53:52] dima at dimych dot sumy dot ua

I`m look everyware in the Internet and don`t find any workaround for
this problem. And error logs still growing...

This code decreases count of warnings:
-- code --
$startTime = microtime_float(true);
socket_send($socket, $package, strLen($package), 0);
socket_set_block($socket);
$to = array('sec' => 0, 'usec' => 500000);
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, $to);
if (socket_read($socket, 4096)) {
  socket_close($socket);
  return microtime_float() - $startTime;
}
socket_close($socket);
-- end of code --
my "ping" function launches once per 5 minutes for around 50 hosts, but
not all of them alive. Dead hosts causes warnings.

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

[2005-11-02 14:37:46] dima at dimych dot sumy dot ua

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.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/35062

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

Reply via email to