--TEST-- Multicast support: IPv6 receive options (limited) --SKIPIF-- 'ff01::114', "interface" => 0, )); if ($so === false) { die('skip unable to join multicast group on any interface.'); } $r = socket_sendto($s, $m = "testing packet", strlen($m), 0, 'ff01::114', 3000); if ($r === false) { die('skip unable to send multicast packet.'); } $so = @socket_set_option($s, IPPROTO_IPV6, MCAST_LEAVE_GROUP, array( "group" => 'ff01::114', "interface" => 0, )); if (defined("MCAST_JOIN_SOURCE_GROUP")) { $so = @socket_set_option($s, IPPROTO_IPV6, MCAST_JOIN_SOURCE_GROUP, array( "group" => 'ff01::114', "interface" => 0, "source" => '2001::dead:beef', )); if ($so !== false) { die('skip protocol independent multicast API is available.'); } } --FILE-- $mcastaddr, "interface" => $interface, )) or die("err"); var_dump($so); $r = socket_sendto($sends1, $m = "testing packet", strlen($m), 0, $mcastaddr, 3000); var_dump($r); checktimeout($s, 500); $r = socket_recvfrom($s, $str, 2000, 0, $from, $fromPort); var_dump($r, $str, $from); $sblock = $from; $r = socket_sendto($sends1, $m = "initial packet", strlen($m), 0, $mcastaddr, 3000); var_dump($r); $i = 0; checktimeout($s, 500); while (($str = socket_read($s, 3000, 500)) !== FALSE) { $i++; echo "$i> ", $str, "\n"; if ($i == 1) { echo "leaving group\n"; $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array( "group" => $mcastaddr, "interface" => $interface, )); var_dump($so); $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000); var_dump($r); $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000); var_dump($r); } if ($i == 2) { echo "re-joining group\n"; $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array( "group" => $mcastaddr, "interface" => $interface, )); var_dump($so); $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000); var_dump($r); } if ($i == 3) { break; } } ?> --EXPECTF-- creating send socket object(Socket)#%d (0) { } creating receive socket object(Socket)#%d (0) { } bool(true) bool(true) int(14) int(14) string(14) "testing packet" string(%d) "%s" int(14) 1> initial packet leaving group bool(true) int(20) int(14) 2> unicast packet re-joining group bool(true) int(12) 3> mcast packet