-
I have a problem with the Inet control.
What I am trying to do is time how long it takes my ASP page to respond. I want to hit this page several times a second and see at what point server response time starts to suffer significantly. Here is the code I have developed:
Code:
Private Declare Function timeGetTime Lib "Winmm.dll" () As Long
Option Explicit
Private Sub cmdGetPage_Click()
Dim t As Integer
Dim b() As Byte
Dim tick1 As Long
Dim tick2 As Long
Dim timeDif As Long
Dim x As Integer
Dim time1 As Long
Dim time2 As Long
Dim txt As String
Open "c:\temp\results.txt" For Output As #1
x = 1
'this loop hits the server 10 times/second for 10 seconds
Do While x < 100
tick1 = timeGetTime()
'download page to byte array
b() = Inet1.OpenURL("http://testsrv1/test.asp", icByteArray)
tick2 = timeGetTime()
timeDif = tick2 - tick1
Write #1, timeDif 'output timeDif to file
time1 = timeGetTime()
time2 = timeGetTime()
'wait 100 ms
Do While time2 - time1 <= 99
time2 = timeGetTime()
Loop
txt = ""
'convert byte array to string
For t = 0 To UBound(b) - 1
txt = txt + Chr(b(t))
Next
Text1.Text = txt 'write HTML to TextBox
x = x + 1
Loop
Close #1
MsgBox "Done!"
End Sub
' ignore
Private Sub SetStatus(strMsg As String, Optional blnErr As Boolean = False)
End Sub
Problem is, I get a bunch of Zeros written to my file... I have figured out that this is because the script on my ASP page does not get processed... the Inet.OpenURL(...) ends up just downloading about 4 static html tags...which takes no time at all.... I need the Inet Control to wait for the ASP to be processed on the server side, before it downloads the HTML.
Does anyone know how I might do this?
Thanks!
-
I just talked with MS and turns out there is a bug in the Inet control....
it's not that the script wasn't getting processed, it's that the openURL method is truncating the data too early. Has to do with a mistake in their code, a while loop that they have checking the bytes sent vs buffer size or something to that effect.
Anyway, the MS guy proposed a work-around using WinInet or using the asynchronous method Inet1.execute() and then use while and a case statement to see when it has finished....
I'll post some code when I get this working.
cheer
/d8/
-