Can't get timeout to work

Author Message
vbscriptn00b

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 12/24/2011
  • Status: offline
Can't get timeout to work Saturday, December 24, 2011 3:44 PM (permalink)
0
I have a script that goes out to multiple webpages and returns an xml file from each.  The issue I am having is if I am unable to connect to the website, it takes up to 30 seconds before it returns with an error it can't connect causing my script to take up to 2-3 minutes to run when it should be about 15 secs max.
If I use the following it works fine except for the long times as explained
err.clear
Dim HTTP
Set HTTP = CreateObject("MSXML2.XMLHTTP")
 http.open "GET", URL, FALSE
 http.setRequestHeader "Content-Type", "text/xml"
 http.send
if(err.number <> 0) then
 
When I try to use the .timeout it will always skip straight through and say it can't connect when I know it can/does cause it will when I take it out.  I tried the following:
 
Dim HTTP
Set HTTP = CreateObject("MSXML2.XMLHTTP")
HTTP.timeout = 10000
Http.ontimeout = timeo
 http.open "GET", URL, FALSE
 http.setRequestHeader "Content-Type", "text/xml"
 http.send
if(err.number <> 0 or isnull(http.responsetext)) then
sdlf;jsalfdj;lsak;js
 
function timeo
wscript "timeout"
end function
 
 
Any ideas or better direction I can go?
 
Thanks
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9