How to set a timeout on a send method?

prp_at_home.com
Date: 04/02/04


Date: Fri, 02 Apr 2004 13:38:35 -0600

I have been looking all over for a way to time out a send method in
vbscript. I have a vbscript that checks the stats of a web page on a
server in my web farm and then act on that status. It will then sleep
for awile and check the status again. The problem is sometimes the OK
status will come back after about 5 minutes or so. I don't want the
script to wait that long to get the status. If it takes more than a
minute, I want the status to be in a fail state whether it comes back 5
minutes later or not. Basically, more than a minute is not acceptable.
How can I do that in vbscript. Here is bit of my code:

<snip>
dim oHTTP
set oHTTP = WScript.CreateObject("Microsoft.XMLHTTP")
oHTTP.open "GET", sSource, False
oHTTP.send
</snip>

It is oHTTP.send I want to set a timeout on. If it does not get a
response in one minute cancel the request and move on to the next
function in the code.

Thanks in advance to anyone that has any suggestions.



Relevant Pages

  • Re: get a textfile from website into memo
    ... HTTP Request like: ... 'Begin VBScript ... Dim oHttp ... Set oHttp = CreateObject ...
    (alt.comp.lang.borland-delphi)
  • Re: Recommended Approach
    ... Dan heres a vbscript that download a zip file from web, ... set oHTTP = WScript.CreateObject ... oStream.savetofile sDest, adSaveCreateOverWrite ...
    (microsoft.public.sqlserver.security)
  • How do I instanciate a MSXML2.XMLHTTP60 object?
    ... In My VBScript the following instruction creates a Microsoft.XMLHTTP ... Set oHTTP = WScript.CreateObject ... Set xml = New XMLHTTP60 ...
    (microsoft.public.scripting.vbscript)
  • error using STREAM.ReadText
    ... I use VBScript: ... set oHTTP = CreateObject ... set oStream = createobject ... Error msg: ...
    (microsoft.public.sqlserver.dts)