1--TEST-- 2Multicast support: IPv6 send options 3--EXTENSIONS-- 4sockets 5--SKIPIF-- 6<?php 7 8if (getenv('CI_NO_IPV6') || !defined('IPPROTO_IPV6')) { 9 die('skip IPv6 not available.'); 10} 11$level = IPPROTO_IPV6; 12$s = socket_create(AF_INET6, SOCK_DGRAM, SOL_UDP) or die("skip Cannot create socket"); 13if (socket_set_option($s, $level, IPV6_MULTICAST_IF, 1) === false) { 14 die("skip interface 1 either doesn't exist or has no ipv6 address"); 15} 16?> 17--FILE-- 18<?php 19$domain = AF_INET6; 20$level = IPPROTO_IPV6; 21$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err"); 22 23echo "Setting IPV6_MULTICAST_TTL\n"; 24$r = socket_set_option($s, $level, IPV6_MULTICAST_HOPS, 9); 25var_dump($r); 26$r = socket_get_option($s, $level, IPV6_MULTICAST_HOPS); 27var_dump($r); 28echo "\n"; 29 30echo "Setting IPV6_MULTICAST_LOOP\n"; 31$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 0); 32var_dump($r); 33$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP); 34var_dump($r); 35$r = socket_set_option($s, $level, IPV6_MULTICAST_LOOP, 1); 36var_dump($r); 37$r = socket_get_option($s, $level, IPV6_MULTICAST_LOOP); 38var_dump($r); 39echo "\n"; 40 41echo "Setting IPV6_MULTICAST_IF\n"; 42echo "interface 0:\n"; 43$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 0); 44var_dump($r); 45$r = socket_get_option($s, $level, IPV6_MULTICAST_IF); 46var_dump($r); 47echo "interface 1:\n"; 48$r = socket_set_option($s, $level, IPV6_MULTICAST_IF, 1); 49var_dump($r); 50$r = socket_get_option($s, $level, IPV6_MULTICAST_IF); 51var_dump($r); 52echo "\n"; 53?> 54--EXPECT-- 55Setting IPV6_MULTICAST_TTL 56bool(true) 57int(9) 58 59Setting IPV6_MULTICAST_LOOP 60bool(true) 61int(0) 62bool(true) 63int(1) 64 65Setting IPV6_MULTICAST_IF 66interface 0: 67bool(true) 68int(0) 69interface 1: 70bool(true) 71int(1) 72