473,396 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HttpRequest and timeout

I use an HttpRequest in my web application to launch an heavy
computation server side. The result is then send back to the browser.
The problem I got is that when the computation took too much time, then
I never get the result. I have to reload the page to get it.

I assume it's because my socket connection has time out, but my event
listener does not seems to get any event. Maybe I miss something:

function xmlhttpChange()
{
// looking fo a xmlhttp "loaded"
for (var i in nodeId2xmlHttp) {
if ((nodeId2xmlHttp[i] != null) && nodeId2xmlHttp[i].readyState ==
4) {
if (nodeId2xmlHttp[i].status==200) {
nodeId2xmlHttp[i] = null;
} else {
alert("Problem retrieving XML data (nodeId: " + i + ")");
nodeId2xmlHttp[i] = null;
}
}
}
}

My question is : how to handle XMLHttpRequest timeout. Any pointers ?

Dec 20 '05 #1
3 11985
VK

hu************@gmail.com wrote:
My question is : how to handle XMLHttpRequest timeout. Any pointers ?


Request timeout is a system setting (this is why it's called "system
timeout"). You cannot handle it in the standard security environment.
Moreover you even cannot guess reliably what timeout set for a
particular machine.

Very approximately you can be safe within 10sec interval. You can add
extra interval by using "something back" trick: return content header
right away (200, text/html etc.) then start your calculations and spit
out an empty string or someting every 5-10 sec into the open channel.

On a really long run you should use the method applied by online
booking systems (like Travelocity.com) Upon request you send back id of
the result file like sid2894838292, close connection, do calculations,
save results sid2894838292 and exit.

Page will try to read sid2894838292 with the instructed delay (10sec,
20sec, 30 sec)

Nothing reliable you can do with JavaScript only.

Dec 21 '05 #2
Thanks for the quick and clear answer. It appears to me that http is
not a "connected" mode, and must not be use like if it was. So your
solution seems the way to go for me.

Dec 21 '05 #3
VK

hu************@gmail.com wrote:
Thanks for the quick and clear answer. You are very welcome.
It appears to me that http is
not a "connected" mode, and must not be use like if it was.


Very true. Just to have the whole picture: modern HTTP has Keep-Alive
request but it's support and implementation is something I wouldn't
suggest to trust at all. Especially in anyhow serious project and
definitely not in money transactions.

Dec 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: HikksNotAtHome | last post by:
In Mozilla 1.4b, when the URL is set to a local URL, it works as expected. function showIt(){ var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "blank.html" ,true);...
0
by: Bp | last post by:
I'm writing a simple HTTPRequest that retrieves the content of a web page. Dim httpReq As System.Net.HttpWebRequest Dim httpResp As System.Net.HttpWebResponse httpReq =...
1
by: James | last post by:
Hi, I am new to .NET framework. I am trying to get data from the third party web application using WebHTTPRequest and Response class. I am getting TimeOut exception at GetResponse Method.. ...
4
by: Daniel Rimmelzwaan | last post by:
I am having trouble getting the XML out of an HttpRequest object. I am sending the XML from biztalk into my aspx page, after which I want to take the XML out of it and process it using a...
1
by: Mark Miller | last post by:
I just recently started getting the above error on a page I am posting MULTIPART/FORM-DATA. We have SoftArtisans FileUp component and Filter installed on the server in question and up until a day...
11
by: Keith Patrick | last post by:
Could someone explain to me the relationship between these two classes? I am ripping my hair out trying to divert an HttpRequest to a new location via an HttpWebRequest, but I cannot get my...
1
by: Gunnar | last post by:
I am finding some unusual behavior with techniques I am using to show/hide/update data without having to refresh the page. I'm quite sure it's developer ignorance on my part and would be grateful...
2
by: oopaevah | last post by:
I am using the Microsoft.XMLHTTP object to make server requests ie; ajax. This is working 99% of the time but occasionally it will freeze at the server for 5 minutes and then raise a javascript...
1
by: Jeff | last post by:
ASP.NET 2.0 I'm about to program a HttpRequest from my asp.net 2.0 website. I'll request another server using HttpRequest and ask if password etc are okay.... So I've looked into the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.