non-standard behavior of socket_recvfrom()
| From: | Ron Korving | Date: | Sun, 07 Aug 2005 16:18:26 +0000 |
| Subject: | non-standard behavior of socket_recvfrom() | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-17572@lists.php.net to get a copy of this message | ||
Hi,
This may be an odd suggestion/request, and nothing in the line of what's
currently hot around here (PHP 5.1 that is), but I'm making it anyway:
The current behavior of socket_recvfrom() (/etc/sockets/socket.h) on a
connection error, is that it frees the buffer (recv_buf), throws an error
and returns from the function. I'd like to suggest that more correct
behaviour would be to use the buffer before returning. As far as I know,
even on failure, the buffer can be used to extract information on why the
connection was refused.
I came upon this while I was trying to implement a traceroute algorithm,
which should be pretty simple, but seems impossible because of this socket
behavior in PHP. The change in the code of socket_recvfrom() would be very
minimal. I would suggest a patch myself, but the problems are that I don't
know how and I don't know nearly enough about the PHP engine to write solid
code for it (maybe I should work on that).
Ron