I'm trying to create a multicast server in PHP using the following code:
$this->sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_set_option($this->sock, IPPROTO_IP, MCAST_JOIN_GROUP, ['group' => '255.1.1.1', 'interface' => "eth0"]);
socket_set_option($this->sock, IPPROTO_IP, IP_MULTICAST_TTL, 2);
but I'm receiving the error:
socket_set_option(): unable to set socket option [22]: Invalid argument
On the line setting MCAST_JOIN_GROUP
. I can't seem to find much info related to PHP multicast servers online. Does anyone have experience with this problem?
I'm using PHP 5.5.9 on a ubuntu 14.04.2 VMWare 7.1.2 VM. I have verified that eth0 is the primary network interface on the VM.