go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  How to Fix It?
 
Subject: How to Fix It?
Author: EricJ
In response to: "Connection refused" vs "Address already in use"
Posted on: 04/13/2007 02:53:43 PM

The maximum queue length of the server for incoming connection indications (a request to connect) is set to 50. If a connection indication arrives when the queue is full, the connection is refused. If your server is a popular and busy one, you may want to increase the backlog to 1000, for example:

        ServerSocket sc = new ServerSocket(PORT, 1000);


 

> On 04/13/2007 02:39:42 PM EricJ wrote:

Unlike "Address already in use" error which is caused by client side settings about maximum port can be mobilized during a certain amount of time, "Connection refused" is caused by server side settings which internationally rejected your connection for some reasons. Most likely, your client application is so aggressive in acquiring connection that the backlog queue of the remote server is full.

It's also interesting to note that "Address already in use" error happened in one thread environment and "Connection refused" error happened within multiple threads environment, even though they both try to open connection by calling the same code:

      try{
          socket = new Socket(addr, PORT);
      }catch(IOException e){
          e.printStackTrace();
          System.exit(-1);
      }





References:

 


 
Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
 
Get your own forum today. It's easy and free.