Code example for ServerSocketChannel

Methods: socketconfigureBlocking

0
 
  public TNonblockingServerSocket(InetSocketAddress bindAddr, int clientTimeout) throws TTransportException {
    clientTimeout_ = clientTimeout;
    try { 
      serverSocketChannel = ServerSocketChannel.open();
      serverSocketChannel.configureBlocking(false);
 
      // Make server socket 
      serverSocket_ = serverSocketChannel.socket();
      // Prevent 2MSL delay problem on server restarts 
      serverSocket_.setReuseAddress(true);
      // Bind to listening port 
      serverSocket_.bind(bindAddr);
    } catch (IOException ioe) {
      serverSocket_ = null;
      throw new TTransportException("Could not create ServerSocket on address " + bindAddr.toString() + ".");
    } 
  } 
 
  public void listen() throws TTransportException { 
Contextual code suggestions in your IDE  Get Codota for Java