workerman怎么样去发广播? 比如发送udp广播到192.168.1.255上
udp广播直接用php的接口就行
php手册的例子: http://php.net/manual/en/function.socket-sendto.php#57746
workerman中的例子: https://github.com/walkor/workerman-statistics/blob/master/Applications/Statistics/Modules/admin.php#L25
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); socket_set_option($sock, SOL_SOCKET, SO_BROADCAST, 1); socket_sendto($sock, $broadcast_string, strlen($broadcast_string), 0, '255.255.255.255', $port);
udp广播直接用php的接口就行
php手册的例子:
http://php.net/manual/en/function.socket-sendto.php#57746
workerman中的例子:
https://github.com/walkor/workerman-statistics/blob/master/Applications/Statistics/Modules/admin.php#L25
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_set_option($sock, SOL_SOCKET, SO_BROADCAST, 1);
socket_sendto($sock, $broadcast_string, strlen($broadcast_string), 0, '255.255.255.255', $port);