Thanks for the speedy response. I'm afraid I didn't specify my question well enough.
The application is a lightweight network monitoring app in a web page. The browser periodically issues the ajax() call to various addresses to determine if the host responds or not. Either way, the browser updates its page to show the current state of the devices it has queried. (If you're terminally curious, you can check
http://TestMyInter.net )
Getting any kind of error response (even a CORS error) is good: it's an indication that the other end is present - that's all I care about. A timeout, on the other hand, shows that the device is simply not responding.
Some of the queries are made to hosts that I already know are down/unresponsive. So I'm trying to distinguish two kinds of timeouts:
- The ajax() code above specifies a 6 second (6000 msec) timeout. When it times out, the completion routine gets a textStatus of "timeout" as expected
- Sometimes - maybe 5% of the time - the timeouts seem to happen after 3-5 seconds - well before the ajax() call's 6-second timer. When it happens, the (Chrome) console displays the ERR_CONNECTION_TIMED_OUT message. The bad news (at least from my application's standpoint) is that textStatus in the completion routine is 'error' - the same as if the device had responded with a CORS violation...
I don't know what causes that second case, nor do I know how to detect it. My web page app continually sends these queries (every minute) and (on Chrome), the second case crops up out of the blue, when querying a known non-existent address (say, 127.0.0.20). I never see it happen on Firefox or Safari.
I wrote to this forum to see if there's someone who knows the deep underpinnings of ajax(), and how Chrome, Firefox, and Safari might handle it differently.
Any thoughts? Any ideas where else I could post this question? Many thanks!