void createImpl() throws SocketException { if (impl == null) { if (factory != null) { impl = factory.createDatagramSocketImpl(); checkOldImpl(); } else { boolean isMulticast = (this instanceof MulticastSocket) ? true : false; impl = DefaultDatagramSocketImplFactory.createDatagramSocketImpl(isMulticast); checkOldImpl(); } } // creates a udp socket impl.create(); created = true; }
/** * Creates an unbound datagram socket with the specified DatagramSocketImpl. * * @param impl an instance of a <B>DatagramSocketImpl</B> the subclass wishes to use on the * DatagramSocket. * @since 1.4 */ protected DatagramSocket(DatagramSocketImpl impl) { if (impl == null) throw new NullPointerException(); this.impl = impl; checkOldImpl(); }