Re: [RFC] Fixing #72733 : Implement getaddrinfo
| From: | David Walker | Date: | Fri, 12 Aug 2016 22:04:58 +0000 |
| Subject: | Re: [RFC] Fixing #72733 : Implement getaddrinfo | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-95105@lists.php.net to get a copy of this message | ||
On Thu, Aug 11, 2016 at 6:50 PM Bishop Bettini <bishop@php.net> wrote:
> I feel the weight of new functions, but really getaddrinfo is meant to
> both simplify and unify how sockets are dealt with in the modern era.
> socket_getaddrinfo converts the returned linked list into an array of,
> essentially, socket contexts. The user can inspect those contexts and
> choose the one he wants to use in connect and bind. Simple.
>
> With a few minor tweaks to naming (to lump all the addrinfo functions
> together), this makes sense to me:
>
> $contexts = socket_addrinfo_lookup($node, $service, $hints);
> foreach ($contexts as $context) {
> print_r(socket_addrinfo_explain($context));
> }
> $socket = socket_addrinfo_connect($contexts[1]);
> // ...
>
> So I would lean toward flavor #1. Thanks!
>
Bishop,
Thanks, I was really thinking that #1 would be preferred over altering
argument types to long-existing functions. I have updated the RFC to
include only it's implementation as well as changed the function names.
--
Dave