开发者

UDP Broadcasting with PHP

I cannot figure how to broadcast a UDP datagram to my local network with PHP. This is the sample code I use :

$socket = stream_socket_client("udp://255.255.255.255:12478", $errno, $errstr);

I tried with 192.168.0.255 instead of 255.255.255.255 but I get the same result :

Warning: stream_socket_client(): unable to connect to udp://255.255.255.255:12478 (Permission denied)

Is this a limitation in the configuration of my OS (Debian Linux) ? Or a misuse of broadcasting options on my开发者_开发知识库 side ?

Any help is appreciated ! Thanks !

Lionel


The terms 'udp' and 'stream' are mutually exclusive. Also broadcasting is very different from other network operations.

See the note at the bottom of the socket_sendto() manual page. (The first hit if you google for 'php udp broadcast')

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜