sockets - java.net.SocketException Connection timed out error -
I am getting the error when I'm trying to connect to a TCP server. My programs try to open around 300-400 connections using different sources and this is happening during the 250 th thread. The PlainSocketImpl.java can be caused by invalid address java.net.PlainSocketImpl.doConnect (: uses its own connection to send each thread and receive data here is the code I use to get a thread socket: Is there a default limit on the number of connections that a TCP server can have at one time? If not, how to solve this type of problems?
java.net .SocketException :. connection timed out: 372) on java.net.PlainSocketImpl.connectToAddress (PlainSocketImpl.java:233) java.net.PlainSocketImpl.connect (PlainSocketImpl.java:220) on java.net.SocksSocketImpl.connect (SocksSocketImpl .java: 385)
socket = new socket (my_hostName, my_port );
server, you may be getting a connection timeout a Srhwarseket which port you can connect , But is bound, but he is not accepting the connection. If it is always with a connection to 250, then the server is set to accept only 250 connections. Someone has to disconnect so that you can connect. Or you can increase timeout; Instead of making it like socket, empty Create socket with constructor and then connect () Use Method: The default connection timeout is 30 seconds; Waiting for 90 seconds to connect to the above code, then throws an exception if the connection can not be established. You can also set fewer connection timeouts and do something else when you catch that exception ... Socket s = new Socket (); S.connect (new InetSocketAddress (my_hostName, my_port), 90000);
Comments
Post a Comment