Add DatagramChannel.isConnected()
.. because there is no way for a user with isActive to know if DatagramChannel is connected or not
This commit is contained in:
parent
9ec51d01d6
commit
f60a6e861c
@ -35,6 +35,8 @@ public interface DatagramChannel extends Channel {
|
||||
@Override
|
||||
InetSocketAddress remoteAddress();
|
||||
|
||||
boolean isConnected();
|
||||
|
||||
/**
|
||||
* Joins a multicast group.
|
||||
*/
|
||||
|
@ -112,6 +112,11 @@ public final class NioDatagramChannel
|
||||
return ch.isOpen() && ch.socket().isBound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected() {
|
||||
return javaChannel().isConnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DatagramChannel javaChannel() {
|
||||
return (DatagramChannel) super.javaChannel();
|
||||
|
@ -109,6 +109,11 @@ public class OioDatagramChannel extends AbstractOioMessageChannel
|
||||
return isOpen() && socket.isBound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected() {
|
||||
return socket.isConnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SocketAddress localAddress0() {
|
||||
return socket.getLocalSocketAddress();
|
||||
|
Loading…
Reference in New Issue
Block a user