I would like to make as many concurrent connections as I need. I think I need a connection/object pool but I am not sure. I believe that I am only allow 2 connections at a time (correct?). I want to speed things up somehow. Currently I use this for loop to get all my required data...
Thanks, Kevin C
[ November 09, 2005: Message edited by: Kevin Cornwell ]
[ November 09, 2005: Message edited by: Kevin Cornwell ] [ November 09, 2005: Message edited by: Kevin Cornwell ]
In Ajax In Action we have an example project that preloads multiple RSS feeds into a reader. We use the Ajax loader to do this and it can handle multiple requests. I think IE is limited to 2 requests off the top of my head like you suggested.
I think Gecko browsers (Mozill and Firefox can handle a couple more).
A lot of the problems I see with people and doing multiple requests at the same time is using global variables to process the data. This in return will overwrite each other when the request is being sent/processed/etc.
Take a look at my blog at some of the posts (such as session timeout management) where I used a version of the ajax conent loader from Ajax In Action.
Joined: Feb 01, 2005
Thanks for the response.
So tell me if I heard you correctly... There is no way to get more than 2 concurrent connections in IE?
I am checking out your sites now for more info. Is your book in the book stores yet? If so which?
Thanks, Kevin C.
Joined: Nov 08, 2001
On the website, there is a image of a globe that tells you where it is being sold.
The limit of 2 concurrent HTTP connections is a default for IE. It can be overridden by registry settings, but of course, you can only do that on your own test box. Other browsers are more permissive, as far as I know, IE is the only one with such a limit.
If you try to open more than two requests, it won't complain, it'll simply queue them, starting off #3 when #1 is done, etc.
I had a look through your code earlier today, it looks good. I was going to recommend that you use closures to match the XHR objects up with the callbacks, then realised that you were already doing so! This is one of the few situations where I'll recommend closures to everybody, there is no other way of finding out inside the callback which XHR is calling you back. The simple approach is to use a global XHR, but that won't scale to multiple concurrent requests. We provide examples of doinmg it both ways, using a global in chapter 2, then moving to closures in chapter 3 onwards.
Hope that helps,
---<br />Author of...<br />'Ajax in Action' <a href="http://manning.com/crane" target="_blank" rel="nofollow">http://manning.com/crane</a><br />'Prototype & Scriptaculous in Action'<br /><a href="http://manning.com/crane3" target="_blank" rel="nofollow">http://manning.com/crane3</a><br />'Ajax in Practice'<br /><a href="http://manning.com/crane2" target="_blank" rel="nofollow">http://manning.com/crane2</a>
Joined: Feb 01, 2005
Thanks for the reply Dave.
Man, I've searched and searched for that registry setting. Where the heck is it?