1

In our application we have a standard TCP/IP Server socket programming to allow clients to connect to the Server.

What i have noticed is after certain number of connections the client is not able to open up new connection to the server. The number by which i encountered the issues is 946 client connection. After which I got connection refused error on the client side.

The server is running in Linux box (64 bit). The server is still up an running, no out-of-memory error.

I don't see an issue with backlog, since I am having only one client which is looping through and opening up the new connection and put it in the array.

I am performing the stress testing on maximum number of connections the client could open to the server and how to maximize the same.

Any thoughts?

Edit 1: Server is not listening on the the port which I am trying to connect. On the server I got below error.

'08:10:41:055 [*] [TcpServer] - java.net.SocketException: Too many open files <stack trace follows>
08:10:41:055 [*] [TcpServer] - at java.net.PlainSocketImpl.socketAccept(Native Method)
08:10:41:055 [*] [TcpServer] - at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
08:10:41:055 [*] [TcpServer] - at java.net.ServerSocket.implAccept(ServerSocket.java:522)
08:10:41:055 [*] [TcpServer] - at sun.security.ssl.SSLServerSocketImpl.accept(SSLServerSocketImpl.java:317)

I increased the file limit as mentioned here. This solved the issue.

Community
  • 1
  • 1
param83
  • 453
  • 2
  • 6
  • 17
  • When the server gets into this state, run "netstat -a" to make sure it is _actually_ listening on the port that it is supposed to be listening on. The "connection refused" error specifically means that that is nothing listening for connections on the port that the client is trying to connect to. – Kenster Sep 18 '13 at 16:00
  • The part after 'backlog' doesn't make sense. Either you aren't accepting incoming connections fast enough, so you're filling up the backlog, or the listening port has been closed as suggested by @Kenster. – user207421 Sep 19 '13 at 00:07
  • Server is not listening on the the port which I am trying to connect. On the server I got below error. – param83 Sep 23 '13 at 04:50
  • You can't have 'only one client' and 946 connections at the same time. Make up your mind. You're going to have to post some code. There is something severely wrong with your accept() loop. The error you have just posted does not constitute 'server not listening', and increasing the number of file handles doesn't solve the problem, it just moves it. You have a connection leak. – user207421 Sep 23 '13 at 06:16
  • I want to see what is the maximum number of "live" connections that i can open up from the client to my server. Thus, I wasn't closing the connection on the client side. I am putting them in the array on the client side. On the server side I have a new worker thread for each accepted "client" connection. – param83 Sep 24 '13 at 06:06

0 Answers0