Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8797181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:47:56+00:00 2026-06-13T23:47:56+00:00

The context of my work is my local area network. The code samples below

  • 0

The context of my work is my local area network.

The code samples below are written in Java language but my question is about TCP, not programming.

I have experienced the following connection timeout:

  •  2 ms when connection established
    
  • 1 005 ms when host is alive but not listen on the specified socket port
  • 21 000 ms when host is down

This values comes from observation of my network but I presume it exists a RFC.

Here is some information about timeout:

  • RFC 1122
  • RFC 793
  • Nagle’s_algorithm and TCP_NO_DELAY

Can you give me more pointers?

@Override
public void run() {
   for( int port = _portFirst; port < _portLast; ++port ) {
      String  host    = "192.168.1." + _address;
      boolean success = false;
      long    before  = System.currentTimeMillis();
      try {
         Socket        socket   = new Socket();
         SocketAddress endpoint = new InetSocketAddress( host, port );
         socket.connect( endpoint, 0 );
         success = true;
         socket.close();
      }// try
      catch( ConnectException c ){/**/}
      catch( Throwable t ){
         t.printStackTrace();
      }
      long duration = System.currentTimeMillis() - before;
      System.err.println( host + ":" + port + " = " + duration );
      _listener.hostPinged( host, port, success, duration );
   }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:47:57+00:00Added an answer on June 13, 2026 at 11:47 pm

    There is no RFC for connection timeouts. It is impossible for any RFC or other document to know the conditions prevailing in any network in advance.

    In general you can expect a successful connection to be very quick; an ECONNREFUSED (ConnectException: connection refused) to be about as quick; and a connection timeout (ConnectException: connect timeout) to take as long as it takes, depending on the cause, the platforms at both ends, and the nature of the intervening network. In Windows I believe a connection timeout consists of the total time across three connection attempts with timeouts 6s, 12s, and 24s, total 42s; in various Unixes I believe the total is more like 70s, which could result from 3 attempts with timeouts 10s, 20s, and 40s. As you see it is up to the platform. There is also the issue that filling the backlog queue at a Windows server will cause RSTs to be issued to incoming SYNs, where on a Unix/Linux server it will cause no response at all to incoming SYNs.

    You should also note that in Java, and contrary to many years of Javadoc:

    1. A zero connect timeout does not imply an infinite timeout, it implies the platform default timeout, which as shown above isn’t above about 70s;

    2. You cannot specify a connection timeout that increases the platform default; you can only use it to decrease the platform default.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code doesn't work: return this.Context.StockTakeFacts.Select(stf => ((stf.StockTakeId == stocktakeid) && (stf.FactKindId == ((int)kind)))).ToList<IStockTakeFact>();
The following code doesn't work! 'this' in in the context when i access it
this code in my plugin used to work just fine: jQuery('#embedded_obj', context).get(0).getVersion(); and the
I have this below code and it work fine header (content-type: text/xml); $xml =
The following code doesn't work, but it best show what I'm trying to achieve
My local context is /123 and my work partners context is /456, when running
I am reading about which is the recommended life for the data context, but
I've recently being trying to teach myself how parsers (for languages/context-free grammars) work, and
This statement doesnot work in Entity Framework context.sleep.Where(o=>o.clientDateTime.TimeOfDay>new TimeSpan(18,0,0)).ToList(); Please suggest me a workaround.
I'm doing some work with grades and the desire2learn Valence API. In the context

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.