NetworkUtils.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:openhab2-addons 作者:
/**
 * iOS devices are in a deep sleep mode, where they only listen to UDP traffic on port 5353 (Bonjour service
 * discovery). A packet on port 5353 will wake up the network stack to respond to ARP pings at least.
 *
 * @throws IOException
 */
public void wakeUpIOS(InetAddress address) throws IOException {
    try (DatagramSocket s = new DatagramSocket()) {
        byte[] buffer = new byte[0];
        s.send(new DatagramPacket(buffer, buffer.length, address, 5353));
    } catch (PortUnreachableException ignored) {
        // We ignore the port unreachable error
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号