shockley
2003-09-28 05:14:20 UTC
I'm using the procedure below in a loop to download thousands of files
everyday. Once in a while--say, 1 time in 10,000, the oXHTTP.send command
hangs. When this happens, the only thing to do is close the application
with ctrl/alt/del and start the
whole thing again. Is there no way around these manual restarts (other than
the very complex solution I've come up with using a scripting program to
monitor progress)--seems like there should be a built-in error mechanism for
when the command hangs?
Shockley
Sub saveImg(sURL, sPath)
Dim oXHTTP As New MSXML2.XMLHTTP
Dim oStream As New ADODB.Stream
oXHTTP.Open "GET", sURL, False
oXHTTP.send
oStream.Type = adTypeBinary
oStream.Open
oStream.Write oXHTTP.responseBody
oStream.SaveToFile sPath, adSaveCreateOverWrite
oStream.Close
Set oXHTTP = Nothing
Set oStream = Nothing
End Sub
everyday. Once in a while--say, 1 time in 10,000, the oXHTTP.send command
hangs. When this happens, the only thing to do is close the application
with ctrl/alt/del and start the
whole thing again. Is there no way around these manual restarts (other than
the very complex solution I've come up with using a scripting program to
monitor progress)--seems like there should be a built-in error mechanism for
when the command hangs?
Shockley
Sub saveImg(sURL, sPath)
Dim oXHTTP As New MSXML2.XMLHTTP
Dim oStream As New ADODB.Stream
oXHTTP.Open "GET", sURL, False
oXHTTP.send
oStream.Type = adTypeBinary
oStream.Open
oStream.Write oXHTTP.responseBody
oStream.SaveToFile sPath, adSaveCreateOverWrite
oStream.Close
Set oXHTTP = Nothing
Set oStream = Nothing
End Sub