Annotation of embedaddon/php/ext/standard/tests/network/udp6loop.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Streams Based IPv6 UDP Loopback test
        !             3: --SKIPIF--
        !             4: <?php # vim:ft=php:
        !             5:        /* If IPv6 is supported on the platform this will error out with code 111 -
        !             6:         * Connection refused.  If IPv6 is NOT supported, $errno will be set to
        !             7:         * something else (indicating parse/getaddrinfo error)
        !             8:         * Note: Might be a good idea to export an IPv6 support indicator
        !             9:         * (such as AF_INET6 exported by ext/sockets), however, since we
        !            10:         * cannot tell for sure if IPv6 works until we probe it at run time,
        !            11:         * this isn't really practical.
        !            12:         */
        !            13: 
        !            14:        @stream_socket_client('tcp://[::1]:0', $errno);
        !            15:        if ($errno != 111) die('skip IPv6 not supported.');
        !            16: ?>
        !            17: --FILE--
        !            18: <?php
        !            19:        /* Setup socket server */
        !            20:        $server = stream_socket_server('udp://[::1]:31337', $errno, $errstr, STREAM_SERVER_BIND);
        !            21:        if (!$server) {
        !            22:                die('Unable to create AF_INET6 socket [server]');
        !            23:        }
        !            24: 
        !            25:        /* Connect to it */
        !            26:        $client = stream_socket_client('udp://[::1]:31337');
        !            27:        if (!$client) {
        !            28:                die('Unable to create AF_INET6 socket [client]');
        !            29:        }
        !            30: 
        !            31:        fwrite($client, "ABCdef123\n");
        !            32: 
        !            33:        $data = fread($server, 10);
        !            34:        var_dump($data);
        !            35: 
        !            36:        fclose($client);
        !            37:        fclose($server);
        !            38: ?>
        !            39: --EXPECT--
        !            40: string(10) "ABCdef123
        !            41: "

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>