public DatagramChannelImpl(SelectorProvider sp) throws IOException {
   super(sp);
   ResourceManager.beforeUdpCreate();
   try {
     this.family =
         Net.isIPv6Available() ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
     this.fd = Net.socket(family, false);
     this.fdVal = IOUtil.fdVal(fd);
     this.state = ST_UNCONNECTED;
   } catch (IOException ioe) {
     ResourceManager.afterUdpClose();
     throw ioe;
   }
 }
 public DatagramChannelImpl(SelectorProvider sp, ProtocolFamily family) throws IOException {
   super(sp);
   if ((family != StandardProtocolFamily.INET) && (family != StandardProtocolFamily.INET6)) {
     if (family == null) throw new NullPointerException("'family' is null");
     else throw new UnsupportedOperationException("Protocol family not supported");
   }
   if (family == StandardProtocolFamily.INET6) {
     if (!Net.isIPv6Available()) {
       throw new UnsupportedOperationException("IPv6 not available");
     }
   }
   this.family = family;
   this.fd = Net.socket(family, false);
   this.fdVal = IOUtil.fdVal(fd);
   this.state = ST_UNCONNECTED;
 }
 // Constructor for normal connecting sockets
 //
 SocketChannelImpl(SelectorProvider sp) throws IOException {
   super(sp);
   this.fd = Net.socket(true);
   this.state = ST_UNCONNECTED;
 }