/** * Create a new instance from the given {@link MulticastSocket}. * * @param socket the {@link MulticastSocket} which is used by this instance */ public OioDatagramChannel(MulticastSocket socket) { super(null); boolean success = false; try { socket.setSoTimeout(SO_TIMEOUT); socket.setBroadcast(false); success = true; } catch (SocketException e) { throw new ChannelException( "Failed to configure the datagram socket timeout.", e); } finally { if (!success) { socket.close(); } } this.socket = socket; config = new DefaultDatagramChannelConfig(this, socket); }
/** * Create a new instance from the given {@link MulticastSocket}. * * @param socket the {@link MulticastSocket} which is used by this instance */ public OioDatagramChannel(EventLoop eventLoop, MulticastSocket socket) { super(null, eventLoop); boolean success = false; try { socket.setSoTimeout(SO_TIMEOUT); socket.setBroadcast(false); success = true; } catch (SocketException e) { throw new ChannelException( "Failed to configure the datagram socket timeout.", e); } finally { if (!success) { socket.close(); } } this.socket = socket; config = new DefaultDatagramChannelConfig(this, socket); }