<?php require 'config.php'; $command = 0x00; $target = LEDTARGETID; $unique = mt_rand(1, 2000000000); $target = ($target > 0 ) ? 2 ** ($target - 1) : 0; $data = pack("CQL", $command, $target, $unique); $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); socket_set_option($sock, SOL_SOCKET, SO_BROADCAST, 1); for ( $i=0; $i<3; $i++ ) { socket_sendto($sock, $data, strlen($data), 0, LEDADDRESS, 6565); if ( $i < 2 ) usleep(10000); } socket_close($sock); ?>