Re: [RFC][VOTE]: Implement socket_getaddrinfo family

From: Date: Wed, 24 Aug 2016 18:32:10 +0000
Subject: Re: [RFC][VOTE]: Implement socket_getaddrinfo family
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-95436@lists.php.net to get a copy of this message
On Wed, Aug 24, 2016 at 9:48 AM Bishop Bettini <bishop@php.net> wrote: > Also, it may be beneficial to elaborate on the scenarios where >> socket_addrinfo is easier to use than socket_* and friends (getservbyname >> for example) and the costs of that ease (eg, behind the scenes DNS queries). > > Most of the get*by* network related functions are all pretty much wrapped around IPv4 at the transport layer, for example gethostbyname. Specifically[1] there are comments that explain how to implement in userland a gethostbyname6 for IPv6 related lookups. getaddrinfo, and it's inverse getnameinfo, are more modern network interfaces to POSIX that allow us to develop with (generally) transport layer agnostic. As to a specific example case: if I accept user input to connect to a remote site (bear with me here on security implications), I shouldn't need to know if the remote site is v4, or v6 specific. Maybe we're doing a down-detector site and the user input was ipv6.facebook.com, which has no A record, but does have a AAAA record. It's cleaner and easier to just let getaddrinfo figure it out for you. -- Dave [1] - http://php.net/manual/en/function.gethostbyname.php#70936

« previous php.internals (#95436) next »