Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95436 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1715 invoked from network); 24 Aug 2016 18:32:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Aug 2016 18:32:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=dave@mudsite.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dave@mudsite.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain mudsite.com designates 209.85.217.179 as permitted sender) X-PHP-List-Original-Sender: dave@mudsite.com X-Host-Fingerprint: 209.85.217.179 mail-ua0-f179.google.com Received: from [209.85.217.179] ([209.85.217.179:36516] helo=mail-ua0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/AB-10212-838EDB75 for ; Wed, 24 Aug 2016 14:32:24 -0400 Received: by mail-ua0-f179.google.com with SMTP id m60so3591021uam.3 for ; Wed, 24 Aug 2016 11:32:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mudsite-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tYAiTgaf3e01q18NZ53bZIiN1NOFVIw5jh5kJprHGlg=; b=0V6eY/bEFushgv13jwzuX+TfjfHoxqwOtf1cgFYNEkwMhvCocgMEqv2H9MuT8v3Yjc gC1fxEeqUcnZFJFtbgW+zld/5aSWGZNslH+dRIxsok/95FM0FSkblMIlaLH37MQO8fZ6 6YcP0WDuhNlZnIMgp9aZcvia8j6A4HZ5e9oYxboiXlVPFBuh3479b4JkBmZjSsDysxjd WUMXD4aZfI2AIhrEm8aEt9eVzrQOKpdHpK+B1aR0iwtkmZ849/HqC4GQ2KjFuTIuzDm6 X/NDhZvWRS27tnQGuVSBz7gNniAqpxOaatRc4+a5kcK6htwNYEK3LCQOJFvPrJOm2ROc kD4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tYAiTgaf3e01q18NZ53bZIiN1NOFVIw5jh5kJprHGlg=; b=TEST4995eEa/TkXRFTJ+W44/hyiPnrBJLzbdrMNB7E4zgjX2PDtB6Gzl+f6ptYFszi RyzgVoOrVWWXbjZw6iBY3xZ2XNjAbBp4srM2YKRJer/R5tXmTY1ZWmR6EgWLZGtJZOQZ do05uFUqVFEaCric1uIr53XDTXBm7pZUW0zma7NKdITUq78F8/xz+MgdcYJ1z5kHdt90 Eqnsd4bRwCaGysjSBqPNzT2/U+q8G1psZevYngfW5by4hu3wMHDySz8SKRCIQrqcgWij 4bc+GARXpO7QM8l5fsjgVWfqSQoKxAFnzDodOYGwwnZ3DhqrEhCGESA7pG+h+MJWiDlt eiHw== X-Gm-Message-State: AEkoousYZ6fb1YOG50RUUE2UoHkz52ZL1xrFCVg6Yh/51Zes5KR6LO/JgVZYvYDYw4MO/SnvRoj1n8eg1Qn53w== X-Received: by 10.31.65.86 with SMTP id o83mr2066703vka.130.1472063540994; Wed, 24 Aug 2016 11:32:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 24 Aug 2016 18:32:10 +0000 Message-ID: To: bishop@php.net Cc: PHP internals Content-Type: multipart/alternative; boundary=001a114dc52472b566053ad580b4 Subject: Re: [PHP-DEV] [RFC][VOTE]: Implement socket_getaddrinfo family From: dave@mudsite.com (David Walker) --001a114dc52472b566053ad580b4 Content-Type: text/plain; charset=UTF-8 On Wed, Aug 24, 2016 at 9:48 AM Bishop Bettini 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 --001a114dc52472b566053ad580b4--