当所有网络接口都关闭时,绑定的数据报通道会发生什么情况?

问题描述 投票:0回答:0

当我第一次使用类似于下面的代码片段使用通配符地址绑定数据报通道时会发生什么

InetAddress wildCardAddress = InetAddress.getByName("0.0.0.0");
InetSocketAddress isa = new InetSocketAddress(wildCardAddress, 8888);
DatagramChannel channel = DatagramChannel.open(StandardProtocolFamily.INET)
                                         .setOption(StandardSocketOptions.SO_REUSEADDR, true)
                                         .bind(isa);

然后所有网络接口都关闭,一段时间后一些网络接口启动。这个频道是否仍然可行,还是我需要创建一个新频道?

在接口关闭然后再次打开后,我无法接收多播数据包。

java sockets udp
© www.soinside.com 2019 - 2024. All rights reserved.