Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95055 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72769 invoked from network); 12 Aug 2016 00:50:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Aug 2016 00:50:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=bishop.bettini@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bishop.bettini@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.47 as permitted sender) X-PHP-List-Original-Sender: bishop.bettini@gmail.com X-Host-Fingerprint: 209.85.218.47 mail-oi0-f47.google.com Received: from [209.85.218.47] ([209.85.218.47:34506] helo=mail-oi0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C0/52-56950-C3D1DA75 for ; Thu, 11 Aug 2016 20:50:05 -0400 Received: by mail-oi0-f47.google.com with SMTP id l203so16579241oib.1 for ; Thu, 11 Aug 2016 17:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1tYJYhVbAKVqUmjZ4bzTetWqn7bD6NJ5GkZ3Sg9IUK4=; b=QaAhRp/k1xPi+UGdMlT085hyicXj0lYT6PpSRkoIEXcJV+CIPx4MhrcbB8JL5xABrN xJUHnQ0WzbfjOCIk/AV4sltngoIZgmUj84cwTIfXJj905KQyoibv9OHFbEvj+QNG2ju4 ut/dntrvkeUPwpHrgIsR7IMqi/5MtCgUbfwpUryoY9GB2fpMpKjPgusi83hh3N6lcPTn BnrzSKS4sPQdSfji4Fa3ph9+f8AeZi7FrK7we16JmecA3KVt2UHUwzxPS1XPIjlG06ze 6CRVkMpUXgLqmwhH/AWOw4twUWWezs3Kq0Ad7L12K3iH6N9zINHTcAAnaai5lDclWOTX h5PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:from:date:message-id:subject:to:cc; bh=1tYJYhVbAKVqUmjZ4bzTetWqn7bD6NJ5GkZ3Sg9IUK4=; b=Ekwdq2KFryFJPE0fltJplo39Yra8pv2H3C8d/Hcm3Mv9IpEIrKrzFSpq5BR9dUNhGM zEn3XTfDWiH9dARekuvZDtJUPoFVU6hKUUpg5k0DiDDiF3L5LD5j66dlxuIAW+WJBFpW xPa7AmFcL56Od/nTJRGHE63rk97WEKc6nR/YLzKNPp7NUM29Ip8+ylF3XIawIkqVURD+ tJ39PNYE0SKCxuUHeHUczX7fc9/vbTbeT4gzpQDH9OmYJ2vXNUotzMk4ZQT5pgKIBruA RzvkO1ZMAzrXCbNUhmbn1FdJmEsXJnK+8bQ3RflE7lev+CuA7Imn0x5khz7u7PbvREmQ z4gw== X-Gm-Message-State: AEkoouucdoddEkFeh2KieEMtiapOHnzN7u5NreUOs0KcfZ0hgVZHncKwpKlM7Lrg4r+sWdNR1FBBSSodt11Ztg== X-Received: by 10.202.171.73 with SMTP id u70mr6046777oie.42.1470963001951; Thu, 11 Aug 2016 17:50:01 -0700 (PDT) MIME-Version: 1.0 Reply-To: bishop@php.net Sender: bishop.bettini@gmail.com Received: by 10.157.11.214 with HTTP; Thu, 11 Aug 2016 17:49:31 -0700 (PDT) In-Reply-To: References: Date: Thu, 11 Aug 2016 20:49:31 -0400 X-Google-Sender-Auth: 1dthuT8yvPP7gqH3vS-zHEub4QU Message-ID: To: David Walker Cc: PHP internals Content-Type: multipart/alternative; boundary=001a113c51c635a0200539d5435f Subject: Re: [PHP-DEV] Fixing #72733 : Implement getaddrinfo From: bishop@php.net (Bishop Bettini) --001a113c51c635a0200539d5435f Content-Type: text/plain; charset=UTF-8 On Thu, Aug 11, 2016 at 5:59 PM, David Walker wrote: > Hi all, > > I'm looking to resolve this bug, and thought about 2 means in which to > implement the request of exposing C's getaddrinfo() and the addrinfo > structure. There's not really an equivalent means to accomplish this in > userland without trial&error. > > So I'm not sure the communities best-practices on altering current userland > function signatures to implement a new feature. So I've devised 2 means of > implementing this feature but don't know which would be preferred. The > former introduces new functions for addrinfo-specific usage. The second > alters current socket_connect/socket_bind signatures. They are both very > similar in their implementation. I'm filling out an RFC[1] for this > addition, and have details of each implementation idea typed out in it for > you to see what I'm trying. > > Suggestions and advice on best-practice greatly appreciated. > 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! --001a113c51c635a0200539d5435f--