Web page problems with sockets

a_jam_sandwich

Junior Contributor
Joined
Dec 10, 2002
Messages
367
Location
Uk
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

Visual Basic:
        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 doesn't time out so what do I need to do?

Visual Basic:
        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
 
Does no one know? it seems that I can only monitor variables local to the sub or function in the while loop on asp.net if a global varible is set somewhere else the sub or function doesn't seem to know?

Anyone have any ideas to the weird problem

Cheers

Andy
 
Back
Top