The returned object will not declare any public methods that are not declared in the {@link java.net.ServerSocket} class.
140141142143144145146147148149150
{ doListen = true; // allocate an unbound server socket channel ServerSocketChannel serverChannel = ServerSocketChannel.open(); // Get the associated ServerSocket to bind it with ServerSocket serverSocket = serverChannel.socket(); // create a new Selector for use below selector = Selector.open(); // set the port the server channel will listen to serverSocket.bind (new InetSocketAddress (bind,tcpListenPort)); // set non-blocking mode for the listening socket
190191192193194195196197198199200
* @param localEp InetAddress whose port to listen on. */ public void listen(InetAddress localEp) throws IOException { ServerSocketChannel serverChannel = ServerSocketChannel.open(); ServerSocket ss = serverChannel.socket(); ss.bind(new InetSocketAddress(localEp, DatabaseDescriptor.getStoragePort())); serverChannel.configureBlocking(false); SelectionKeyHandler handler = new TcpConnectionHandler(localEp);
419420421422423424425426427428429
} catch (IOException e) { throw new RuntimeException(e); } ServerSocket socket = serverChannel.socket(); try { socket.setReuseAddress(true); } catch (SocketException e)
203204205206207208209210211212213
logger_.info("Starting Encrypted Messaging Service on port {}", DatabaseDescriptor.getStoragePort()); } else { ServerSocketChannel serverChannel = ServerSocketChannel.open(); ss = serverChannel.socket(); ss.setReuseAddress(true); InetSocketAddress address = new InetSocketAddress(localEp, DatabaseDescriptor.getStoragePort()); try { ss.bind(address);
349350351352353354355356357358359
cfg = (SocketAcceptorConfig) req.config; } else { cfg = getDefaultConfig(); } ssc.socket().setReuseAddress(cfg.isReuseAddress()); ssc.socket().setReceiveBufferSize( cfg.getSessionConfig().getReceiveBufferSize()); // and bind. ssc.socket().bind(req.address, cfg.getBacklog());
350351352353354355356357358359360
} else { cfg = getDefaultConfig(); } ssc.socket().setReuseAddress(cfg.isReuseAddress()); ssc.socket().setReceiveBufferSize( cfg.getSessionConfig().getReceiveBufferSize()); // and bind. ssc.socket().bind(req.address, cfg.getBacklog()); if (req.address == null || req.address.getPort() == 0) {
354355356357358359360361362363364
ssc.socket().setReuseAddress(cfg.isReuseAddress()); ssc.socket().setReceiveBufferSize( cfg.getSessionConfig().getReceiveBufferSize()); // and bind. ssc.socket().bind(req.address, cfg.getBacklog()); if (req.address == null || req.address.getPort() == 0) { req.address = (InetSocketAddress) ssc.socket() .getLocalSocketAddress(); } ssc.register(selector, SelectionKey.OP_ACCEPT, req);
356357358359360361362363364365366
cfg.getSessionConfig().getReceiveBufferSize()); // and bind. ssc.socket().bind(req.address, cfg.getBacklog()); if (req.address == null || req.address.getPort() == 0) { req.address = (InetSocketAddress) ssc.socket() .getLocalSocketAddress(); } ssc.register(selector, SelectionKey.OP_ACCEPT, req); channels.put(req.address, ssc);
189190191192193194195196197198199
359360361362363364365366367368369
try { ssc = ServerSocketChannel.open(); ssc.configureBlocking( false ); ssc.socket().bind( req.address, req.backlog ); ssc.register( selector, SelectionKey.OP_ACCEPT, req ); channels.put( req.address, ssc ); } catch( IOException e )