hi, i am working upon serversocket class and opening threads when a new client hits the serversocket....
serverSocket = new ServerSocket(port);
while (true) {
Socket clientSocket = serverSocket.accept();
new Thread(this).start();//opening multiple threads
}
but when 5000 clients hits on this serversocket an error comes of java.net.ConnectException: Connection refused: connect
at many of the clients side.
so plz 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.
can anybody suggest me? thanks in advance..