a_jam_sandwich
Well-known member
I am writing a server monitor for asp.net and have run into a problem ..
I have a function that waits until a varible is set or until a timeout happens see below
Now Application.DoEvents does not work in a asp.net app as far as I can see so the loop times out when commenting out Application.DoEvents
Now if I place Debug.WriteLine("IN LOOP") within the loop like below the response comes through and doesnt time out so what do I need to do?
Thanks
Andy
I have a function that waits until a varible is set or until a timeout happens see below
Code:
Private Function WaitForResponseToBeSent() As Boolean
This function monitors _ServerResponseReceived if a server
has sent info then its set to true. If a timeout occurs then
return false other wise return true
Dim StartTime As Long = Environment.TickCount
While (_ServerResponseReceived = False) And ((Environment.TickCount - StartTime) < 5000) _Timeout)
Application.DoEvents()
End While
If (_ServerResponseReceived = False) Then Return False Else Return True
End Function
Now Application.DoEvents does not work in a asp.net app as far as I can see so the loop times out when commenting out Application.DoEvents
Now if I place Debug.WriteLine("IN LOOP") within the loop like below the response comes through and doesnt time out so what do I need to do?
Code:
Private Function WaitForResponseToBeSent() As Boolean
This function monitors _ServerResponseReceived if a server
has sent info then its set to true. If a timeout occurs then
return false other wise return true
Dim StartTime As Long = Environment.TickCount
While (_ServerResponseReceived = False) And ((Environment.TickCount - StartTime) < 5000) _Timeout)
Debug.WriteLine("IN LOOP")
End While
If (_ServerResponseReceived = False) Then Return False Else Return True
End Function
Thanks
Andy