socket.setBroadcast(flag)
flag
<boolean>
设置或清除 SO_BROADCAST
socket 选项。
当设置为 true
, UDP 包可能会被发送到一个本地接口的广播地址。
This method throws EBADF
if called on an unbound socket.
flag
<boolean>
Sets or clears the SO_BROADCAST
socket option. When set to true
, UDP
packets may be sent to a local interface's broadcast address.
This method throws EBADF
if called on an unbound socket.