本文整理汇总了Java中java.net.MulticastSocket.isClosed方法的典型用法代码示例。如果您正苦于以下问题:Java MulticastSocket.isClosed方法的具体用法?Java MulticastSocket.isClosed怎么用?Java MulticastSocket.isClosed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.net.MulticastSocket
的用法示例。
在下文中一共展示了MulticastSocket.isClosed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: send
import java.net.MulticastSocket; //导入方法依赖的package包/类
/**
* Send an outgoing multicast DNS message.
*
* @param out
* @exception IOException
*/
public void send(DNSOutgoing out) throws IOException {
if (!out.isEmpty()) {
byte[] message = out.data();
final DatagramPacket packet = new DatagramPacket(message, message.length, _group, DNSConstants.MDNS_PORT);
if (logger.isLoggable(Level.FINEST)) {
try {
final DNSIncoming msg = new DNSIncoming(packet);
if (logger.isLoggable(Level.FINEST)) {
logger.finest("send(" + this.getName() + ") JmDNS out:" + msg.print(true));
}
} catch (final IOException e) {
logger.throwing(getClass().toString(), "send(" + this.getName() + ") - JmDNS can not parse what it sends!!!", e);
}
}
final MulticastSocket ms = _socket;
if (ms != null && !ms.isClosed()) {
ms.send(packet);
}
}
}
示例2: send
import java.net.MulticastSocket; //导入方法依赖的package包/类
/**
* Send an outgoing multicast DNS message.
*
* @param out
* @throws java.io.IOException
*/
public void send(DNSOutgoing out) throws IOException
{
if (!out.isEmpty())
{
byte[] message = out.data();
final DatagramPacket packet = new DatagramPacket(message, message.length, _group, DNSConstants.MDNS_PORT);
if (logger.isLoggable(Level.FINEST))
{
try
{
final DNSIncoming msg = new DNSIncoming(packet);
if (logger.isLoggable(Level.FINEST))
{
logger.finest("send(" + this.getName() + ") JmDNS out:" + msg.print(true));
}
}
catch (final IOException e)
{
logger.throwing(getClass().toString(), "send(" + this.getName() + ") - JmDNS can not parse what it sends!!!", e);
}
}
final MulticastSocket ms = _socket;
if (ms != null && !ms.isClosed())
{
ms.send(packet);
}
}
}