Subj : Re: Threading in JavaScript To : comp.lang.javascript,netscape.public.mozilla.jseng From : "Robert Bates" Date : Sun Feb 02 2003 11:18 pm In reference to the HTTP/1.0 and HTTP/1.1 limits - in my experience regardless of what you jack the client side to, you're still being held back by the server. With most servers today being HTTP/1.1 compliant, you only get two sockets per process (and in some cases per IP address box - depends again on the server). Believe me, I've tried everything in some current client's code to work around that limit as they use SOAP for their data retrieval layer on some screens with 10-12 queries, and the server holds me up every time... Best of luck! -Rob "Steve van Dongen" wrote in message news:8m1r3v0305sum1vrcl4n5h7u8iuko37mhb@4ax.com... > On Sun, 02 Feb 2003 13:43:03 +0000, Gordan wrote: > > >Steve van Dongen wrote: > > > >> On Sat, 01 Feb 2003 17:40:17 +0000, Gordan > >> wrote: > > > >[snip] > > > >>>I was thinking about working around this by using IFRAMEs instead of DIVs, > >>>but I have found that the single-thread paradigm also spans frames within > >>>a single browser instance. > >>> > >>>The only workaround I can think of is creating a Java applet or a > >>>plugin/ActiveX control combo (I need the app to be cross-browser) that can > >>>take a URL, or a list of URLs and start downloading them independently. > >>>Then I could fudge the delay loop using a recursive setTimeout() based > >>>function for polling the status, and working around the problem that way. > >>>It wouldn't work around the parallel page generation issues, but it would > >>>at least work around the issue of not being able to fork multiple > >>>simultaneous downloads. > > > >[snip] > > > >> Sounds like you should look into XMLHTTP > >> http://jibbering.com/2002/4/httprequest.html > > > >Thank for the reply, Steve. > > > >I am already aware of the XMLHTTP method for downloading things. > >Unfortunately, it only allows the download of one file at a time, which is > >why I was looking for a different solution that allows me to download > >multiple files simultaneously. > > If you use asyncronous mode you can download as many files as you > want. True, on a strictly technical level, the callbacks will be > processed syncronously because javascript is single threaded, but > there's nothing you can do about that and you'll have that problem > with any solution that involves javascript. > http://msdn.microsoft.com/library/en-us/xmlsdk/htm/xml_mth_or_4to4.asp > > The other thing to consider is that the HTTP 1.0 and 1.1 > specifications allows for four and two socket connections respectively > per server, per process. You can spawn 100 threads and make 100 > requests if you want; however, all but 4/2 will be blocked unless they > are made in different processes. There is a registry key that you can > set to increase the client-side limit but, if I remember right, > neither cannot be set higher than 16. > http://support.microsoft.com/default.aspx?scid=kb;en-us;183110 > > I use XMLHTTP along with setTimeout and setInterval in my pages -- I > make 10-15 requests every 5 seconds or so -- and it works really > nicely. I'm on an intranet with a responsive server though so the > HTTP limit doesn't really affect me. If you're developing for an > internet site you might have some trouble because of the higher > latency. > > Regards, > Steve .