As I understand it, xmlhttp does not support timeouts( am i correct in
this?). As I cannot user XMLHTTPServer I have attempted to use xmlhttp
asynchronously:
xmlhttp = new ActiveXObject("Msxml2.XMLHttp");
xmlhttp.Open("POST", sURL ,True);
xmlhttp.onreadystatechange= HandleStateChange;
xmlhttp.Send(xmldoc);
which would be fine, but I need some way of stopping execution
returning to the calling page/function until either an allotted time
has passed or xmlhttp.readyState == 4, so that it appears to be
synchronous....
Does anyone have ideas as to a solutin or what I have missed?
Ciao,
Dave
With xmlHTTP
.Open "POST", g_strWebServer & "/download.asp?" & intA, True,
g_strUserName, g_strPassword
.setRequestHeader "Content-Type", "text/xml"
.send
intSecondCount = 0
sTime = Timer
Me.ProgressBar.Value = 0
Do Until intSecondCount > 60
If .readyState = 4 Then
Exit Do
End If
If Timer > sTime + 1 Then
Me.ProgressBar.Value = Me.ProgressBar + 1.6
intSecondCount = intSecondCount + 1
sTime = Timer
End If
Loop
Me.ProgressBar.Value = 100
If .readyState <> 4 Then
MsgBox "No response from server while requesting data. Please try
again later", _
vbExclamation, _
"Operation timed out"
GoTo CloseConnection
End If
...
...
...
End With
Any ideas?
"David Carnes" <dav...@NOSPAMbrandtinfo.com> wrote in message news:<uDiq0hCfBHA.2144@tkmsftngp02>...
Ciao,
Dave
Unfortunately I am definately client side and consequently cannot be
confident that ServerXMLHTTP will work as it is said in the MS
documentation that 'Supported platforms include Microsoft Windows®
2000, or Microsoft Windows NT® 4.0 with Microsoft Internet Explorer
5.01 (or later) installed. ServerXMLHTTP fails on other platforms,
such as Microsoft Windows 95 or Microsoft Windows 98.' ( from MS XML
3.0 - XML Reference )....and there is every liklehood that 95 & 98
will be potential client platforms...
"Mathew" <mut...@MegapathDsl.net> wrote in message news:<06dd01c17dd9$9c1176d0$35ef2ecf@TKMSFTNGXA11>...
The send method of the XMLHTTP object is synchronous or asynchronous,
depending on the value of the bAsync parameter in the open method call. If
open is called with bAsync == False, this call does not return until the
entire response is received or the protocol stack times out. If open is
called with bAsync == True, this call returns immediately.
WinInet is the protocol stack used by the XMLHTTP object. Hence if the Send
method is executed synchronously (async == False), the call will timeout
only after the WinHTTP timeout interval (5 minutes).
I can see one way to address your requirement. This is described below:
a) Capture and store the time before executing the send method in a script
variable
b) Instantiate a DHTML Timer (window.setInterval) and set it to execute a
user defined function after a specific amount of time has elapsed (The
number of minutes for which you want to wait for the response)
c) Execute the send method asynchronously and set the onreadystatechange
property of the XMLHTTP object to reference a callback procedure. In the
callback procedure check the readystate of the XMLHTTP object. If it is
equal to 4 and the timer interval has not elapsed, then it would indicate
that the response was obtained within the required time. If this is the
case then cancel the timer (window.clearInterval) and process the retrieved
result.
d) In the timer procedure (Will execute only when the amount of time for
which you wish to wait has elapsed) call the abort method of the XMLHTTP
object to cancel the request that you executed.
You will need to reference the IE DHTML MSDN documentation on the
setInterval and clearInterval methods for information and code samples on
how to use them.
Thanks
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection
Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.