|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-10-19 10:43 UTC] bwoebi@php.net
-Status: Open
+Status: Not a bug
[2016-10-19 10:43 UTC] bwoebi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 06:00:02 2025 UTC |
Description: ------------ Having a dual stack server, php is unable to create two sockets in the same port for different addresses ipv4 and ipv6. Only the first attempt to create the socket succeeds, the second returns "PHP Warning: stream_socket_server(): unable to connect to ... (Address already in use)". Using the defaults 0.0.0.0 and [::]. If the real ip addresses are defined everything works well. Also, $errno equals to 0 and returned value is FALSE as described in /manual/en/function.stream-socket-server.php. ./configure --with-config-file-path=/etc --disable-short-tags --enable-bcmath --enable-calendar --enable-gd-native-ttf --enable-mbstring --enable-pdo=shared --enable-sockets --enable-zip --with-curl=/opt/curlssl/ --with-freetype-dir=/usr --with-gd --with-jpeg-dir=/usr --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-pic --with-png-dir=/usr --with-zlib --with-zlib-dir=/usr --enable-pcntl --with-bz2 -enable-opcache --enable-fpm --with-fpm-systemd Thank you. Test script: --------------- $errno = null; $error = null; $bindto = ['0.0.0.0', '[::]']; $socket = []; for ($x = 0; $x < 2; ++$x) { $ctx = stream_context_create(['socket' => ['bindto' => $bindto[$x] . ':3672']]); $socket[] = stream_socket_server('tls://' . $bindto[$x] . ':3672', $errno, $error, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $ctx); }