note 58970 deleted from function.gethostbyaddr by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 14:54:42 +0000 |
| Subject: | note 58970 deleted from function.gethostbyaddr by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197226@lists.php.net to get a copy of this message | ||
Note Submitter: respaldod at gmail dot com
----
There is a small flaw in the timeout implementation of King Macro's very useful sockets-based
function gethostbyaddr_timeout() below.
The parameters for socket_set_timeout, an alias for stream_set_timeout(), are like this:
( resource stream, int seconds [, int microseconds] )
So if you want to use his parameters, and assuming the $timeout param should be in milliseconds, you
could first convert to microseconds
$timeout *= 1000;
And then change the socket_set_timeout so you have seconds and microseconds along these lines:
@socket_set_timeout($handle, floor($timeout/1000000), $timeout%1000000);