rfc:socket_getaddrinfo
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:socket_getaddrinfo [2016/08/10 01:59] – bp1222 | rfc:socket_getaddrinfo [2016/08/24 15:24] – bp1222 | ||
---|---|---|---|
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:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | This RFC targets a reported feature request in [[https:// | + | This RFC targets a reported feature request in [[https:// |
===== Proposal ===== | ===== Proposal ===== | ||
- | The implementation[1] I'm proposing implements 4 new socket_* | + | The implementation[[https:// |
<file php> | <file php> | ||
- | array socket_getaddrinfo(string node[, mixed service, array hints]) | + | socket_addrinfo_lookup(string node[, mixed service, array hints]) |
- | resource | + | socket_addrinfo_connect(resource $addrinfo) : resource |
- | resource socket_addrinfo_bind(sockaddrresource sockaddr) | + | socket_addrinfo_bind(resource $addrinfo) : resource |
- | null | + | socket_addrinfo_explain(resource $addrinfo) : array |
</ | </ | ||
<file php> | <file php> | ||
<?php | <?php | ||
- | $addrinfo = socket_getaddrinfo(' | + | $addrinfo = socket_addrinfo_lookup(' |
- | $sockaddr = array_shift($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: | ||
- | foreach ($addrinfo as $sockaddr) { | ||
- | socket_addrinfo_close($sockaddr); | ||
- | } | ||
</ | </ | ||
- | |||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | New functionality; | + | New functionality; |
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 51: | Line 47: | ||
===== 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 | ||
- | ===== Implementation ===== | + | Vote End: |
===== References ===== | ===== References ===== | ||
- | [1] - [[https:// | + | * [1] - [[https:// |
rfc/socket_getaddrinfo.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1