VBScript and msxml processor utliziation

Results 1 to 2 of 2

Thread: VBScript and msxml processor utliziation

  1. #1
    Join Date
    Dec 1969

    Default VBScript and msxml processor utliziation

    I&#039;m trying to use the msxml xmlhttp request and I need to set a timeout because it quite often is down or takes a dump on me. Well my issue is that if I put the object in a loop and wait for the "ReadyState" to be at 4 I end up spiking the processor as that loop executes. Also, it&#039;ll spike that processor for the length of time that I set to check before timing out. This just will not be acceptable once my 900 concurrent users start hitting it. It&#039;s been suggested that I use some type of wait methodology and put the process to sleep essentially for a given interval. The problem is I&#039;ve not seen any good examples of this in classic asp. I don&#039;t want to use any third party components either so please any advise or help anyone could provide would be great ! <BR><BR>Code:<BR>function xmlHTTPRequest(strURL)<BR> <BR> dim intTimeOutInSecs, xmlhttp, strStatus, tmStart, tmCurr, intTimeTaken<BR><BR> &#039;This is the timeout set for making xmlhttp requests, if this is exceeded a error message will<BR> &#039;prompt users to try again later<BR> intTimeOutInSecs = 30<BR><BR> set xmlhttp = CreateObject("Msxml2.xmlhttp.3.0")<BR> xmlhttp.open "GET", strURL, true<BR> xmlhttp.send ""<BR> <BR> tmStart = Now<BR> Do while xmlhttp.readyState &#060;&#062; 4<BR> tmCurr = Now<BR> intTimeTaken = CInt(DateDiff("s",tmStart,tmCurr))<BR> if intTimeTaken &#062; intTimeOutInSecs then<BR> xmlhttp.abort<BR> exit do<BR> end if<BR> Loop<BR> <BR> if xmlhttp.readyState = 4 then<BR> xmlHTTPRequest = xmlhttp.responseText<BR> else<BR> xmlHTTPRequest = "Error"<BR> end if<BR><BR>end function

  2. #2
    Join Date
    Dec 1969

    Default Instead of checking the readystate

    property, you might try using the ServerXMLHttp object and calling the setTimeouts method before you call the open method.<BR><BR>Here is an example on MSDN:<BR>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/xml_mth_sz_0cj7.asp<BR><BR>Also, ServerXMLHttp has a method called waitForResponse where you can set the timeout in seconds.<BR><BR>Hope that helps<BR>Pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts