/** * Disconnect this channel, if it is a datagram socket. Disconnecting a datagram channel will * disassociate it from any address, so the socket will remain open, but can send and receive * datagrams from any address. * * @throws IOException If disconnecting this channel fails, or if this channel is not a datagram * channel. */ public void disconnect() throws IOException { if (kind != Kind.SOCK_DGRAM) throw new IOException("can only disconnect datagram channels"); disconnect(nfd.getNativeFD()); }