public static DatagramChannel openChannelInet4() throws IOException
Opens a new
DatagramChannel. If possible, this method will call
StandardProtocolFamily.INET. This will limit the socket to
method is only available in JDK 1.7 and newer. In order to stay
compatible with JDK 1.6 (both at compile-time and run-time), this method
actually uses reflection for calling the
DatagramChannel.open(ProtocolFamily) method. If the method
cannot be called (for example because the software is running on JRE 1.6
or reflection fails due to security restrictions), it falls back to
DatagramChannel.open(). In this case, however, the
returned channel will not be restricted to IPv4.
Any exception thrown by
DatagramChannel.open(ProtocolFamily) is also thrown by this
method. Any exception caused by reflection is caught by this method and
DatagramChannel.open() is called directly instead.
DatagramChannel.open(StandardProtocolFamily.INET)(the latter is preferred).
IOException- if the called
openmethod throws such an exception.
Copyright © 2014–2016 aquenos GmbH. All rights reserved.