|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-12-08 21:54 UTC] jani@php.net
[2009-12-09 08:26 UTC] mbeeching at btinternet dot com
[2009-12-16 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 20:00:01 2025 UTC |
Description: ------------ OK, firstly, without a context paramter specifying a bindto, stream_socket_client() fails to connect to IPv6 IP's with the following warning: Warning: stream_socket_client(): unable to connect to tcp://[2001:470:1f09:11c:6d6b:7061:7373:7764]:6667 (Unknown error) in /usr/home/jobe/working/php/test.php on line 8 Secondly when you use a stream context as returned by stream_context_create() to specify an IPv6 IP or :: (the 0 of IPv6) address and port to bind a client connection, stream_socket_client() always responds with the following warning: Warning: stream_socket_client(): failed to bind to '2001:470:1f09:11c:0:0:6a6f:6265:0', system said: Can't assign requested address in /usr/home/jobe/working/php/test.php on line 8 Now I can confirm the IPv6 address 2001:470:1f09:11c::6a6f:6265 IS available on a local interface as I have other applications using it. Also the connection IS established, but is NOT bound to the IPv6 IP specified. Reproduce code: --------------- For first issue: $fp = stream_socket_client("tcp://[2001:470:1f09:11c:6d6b:7061:7373:7764]:6667", $errno, $errstr, 30); if (!$fp) { die("$errstr ($errno)\n"); } For second issue: $opts = array('socket' => array('bindto' => '[2001:470:1f09:11c::6a6f:6265]:0')); $ctx = stream_context_create($opts); $fp = stream_socket_client("tcp://[2001:470:1f09:11c:6d6b:7061:7373:7764]:6667", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $ctx); if (!$fp) { die("$errstr ($errno)\n"); } Expected result: ---------------- For the first issue I expect stream_socket_client() to successfully connect to the IPv6 IP specified binding to [::]:0 in the same way it binds to 0:0 for IPv4 For the second issue I expect stream_socket_client() to successfully connect to the IPv6 IP specified binding to the context's IPv6 IP specification. Actual result: -------------- For the first issue no connection is established and a warning is issued. For the second issue a warning is issued, the connection is established, but is not bound to the IPv6 IP specified.