513514515516517518519520521522523
if (ch.socket().getTrafficClass() != cfg.getTrafficClass()) { ch.socket().setTrafficClass(cfg.getTrafficClass()); } ch.configureBlocking(false); ch.socket().bind(req.address); if (req.address == null || req.address.getPort() == 0) { req.address = (InetSocketAddress) ch.socket() .getLocalSocketAddress(); }
112113114115116117118119120121122
if( localAddress != null ) { ch.socket().bind( localAddress ); } ch.connect( address ); ch.configureBlocking( false ); initialized = true; } finally { if( !initialized )
421422423424425426427428429430431
DatagramChannel ch = null; try { ch = DatagramChannel.open(); ch.configureBlocking( false ); ch.socket().bind( req.address ); ch.register( selector, SelectionKey.OP_READ, req ); channels.put( req.address, ch ); } catch( Throwable t )
545546547548549550551552553554555
136137138139140141142143144145146
if (localAddress != null) { ch.socket().bind(localAddress); } ch.connect(address); ch.configureBlocking(false); initialized = true; } catch (IOException e) { return DefaultConnectFuture.newFailedFuture(e); } finally { if (!initialized && ch != null) {
102103104105106107108109110111112
protected DatagramChannel open(SocketAddress localAddress) throws Exception { final DatagramChannel c = DatagramChannel.open(); boolean success = false; try { new NioDatagramSessionConfig(c).setAll(getSessionConfig()); c.configureBlocking(false); c.socket().bind(localAddress); c.register(selector, SelectionKey.OP_READ); success = true; } finally { if (!success) {
126127128129130131132133134135136
if( localAddress != null ) { ch.socket().bind( localAddress ); } ch.connect( address ); ch.configureBlocking( false ); initialized = true; } catch( IOException e ) { return DefaultConnectFuture.newFailedFuture( e );
519520521522523524525526527528529
27642765276627672768276927702771277227732774
if (localAddress != null) { datagramChnl.socket().bind(localAddress); } datagramChnl.configureBlocking(false); datagramChnl.connect(remoteAddress); SelectionKey key = datagramChnl.register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE);