title: will ServerSocket(port) and multiple threading works well for 5000 simultaneous clients hits?
body: <p>I am working with the serversocket class and opening threads when a new client hits the serversocket:</p>
  
  <pre><code>serverSocket = new ServerSocket(port);
  
  while (true) {
          Socket clientSocket = serverSocket.accept();
          new Thread(this).start();//opening multiple threads
  }
  </code></pre>
  
  <p>but when 5000 clients hits on this serversocket an error shows up on the client side: <code>java.net.ConnectException: Connection refused: connect</code></p>
  
  <p>Please tell me what is the better way to open a serversocket so that it can accept all the client connections? there is a 1 millisecond time gap between simultaneous client connections.</p>