Code example for SocketException

Methods: printStackTrace

0
    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 { 
    // Make sure not to block on accept 
    if (serverSocket_ != null) {
      try { 
        serverSocket_.setSoTimeout(0);