rfc:socket_getaddrinfo
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:socket_getaddrinfo [2016/08/24 15:20] – bp1222 | rfc:socket_getaddrinfo [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2016-08-08 | * Date: 2016-08-08 | ||
* Author: David Walker (dave@mudsite.com) | * Author: David Walker (dave@mudsite.com) | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 10: | Line 10: | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | The implementation[[https:// | + | The implementation[[https:// |
<file php> | <file php> | ||
socket_addrinfo_lookup(string node[, mixed service, array hints]) : array | socket_addrinfo_lookup(string node[, mixed service, array hints]) : array | ||
Line 18: | Line 18: | ||
</ | </ | ||
+ | IPv4 Example | ||
<file php> | <file php> | ||
<?php | <?php | ||
- | $addrinfo = socket_addrinfo_lookup(' | + | $addrinfo = socket_addrinfo_lookup(' |
$sockaddr = reset($addrinfo); | $sockaddr = reset($addrinfo); | ||
if (!$sockaddr) die ("No Valid Socket Types" | if (!$sockaddr) die ("No Valid Socket Types" | ||
$sock = socket_addrinfo_bind($sockaddr); | $sock = socket_addrinfo_bind($sockaddr); | ||
// ^^ $sock is a socket resource that is bound to 127.0.0.1: | // ^^ $sock is a socket resource that is bound to 127.0.0.1: | ||
+ | |||
+ | var_dump(socket_addrinfo_explain($sockaddr)); | ||
+ | /* Outputs: | ||
+ | array(5) { | ||
+ | [" | ||
+ | int(0) | ||
+ | [" | ||
+ | int(2) | ||
+ | [" | ||
+ | int(1) | ||
+ | [" | ||
+ | int(6) | ||
+ | [" | ||
+ | array(2) { | ||
+ | [" | ||
+ | int(2000) | ||
+ | [" | ||
+ | string(9) " | ||
+ | } | ||
+ | } | ||
+ | */ | ||
+ | </ | ||
+ | |||
+ | IPv6 Example | ||
+ | <file php> | ||
+ | <?php | ||
+ | $addrinfo = socket_addrinfo_lookup(' | ||
+ | $sockaddr = reset($addrinfo); | ||
+ | if (!$sockaddr) die ("No Valid Socket Types" | ||
+ | $sock = socket_addrinfo_bind($sockaddr); | ||
+ | // ^^ $sock is a socket resource that is bound to [::1]:2000 using TCP/IP ready for reading | ||
+ | |||
+ | var_dump(socket_addrinfo_explain($sockaddr)); | ||
+ | /* Outputs: | ||
+ | array(5) { | ||
+ | [" | ||
+ | int(0) | ||
+ | [" | ||
+ | int(10) | ||
+ | [" | ||
+ | int(1) | ||
+ | [" | ||
+ | int(6) | ||
+ | [" | ||
+ | array(2) { | ||
+ | [" | ||
+ | int(2000) | ||
+ | [" | ||
+ | string(3) ":: | ||
+ | } | ||
+ | } | ||
+ | */ | ||
</ | </ | ||
Line 45: | Line 98: | ||
==== New Constants ==== | ==== New Constants ==== | ||
Exposing the AI_* family of constants. | Exposing the AI_* family of constants. | ||
- | |||
- | ===== Open Issues ===== | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
- | Vote to implement the new functions, would require a 2/3 majority. | + | Vote to implement the new functionality, would require a 2/3 majority. |
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | Vote Start: 2016-08-24 15:23 UTC | ||
+ | |||
+ | Vote End: | ||
===== Implementation ===== | ===== Implementation ===== | ||
+ | |||
+ | - merged into master (i.e. pre 7.2) | ||
+ | - https:// | ||
+ | - https:// | ||
+ | - a link to the PHP manual entry for the feature | ||
===== References ===== | ===== References ===== | ||
* [1] - [[https:// | * [1] - [[https:// |
rfc/socket_getaddrinfo.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1