In that case, you'll be writing a proxy server. When a client connects to the proxy for the first time, you record the current time. Every time the client makes another request, you check the current time against the one that was recorded on first connection. Greater than 30 seconds? Don't forward the request to the destination server.
For some reason, the 'instr' function and the 'string.indexof' is the same.
The problem is that one of the 2 string arguments, is a variable that is passed from the calling subroutine (not the literal characters) and it does not recognise the 'match'.
When I type in the literal characters with " " -- it works ok.
Here is a copy of the line that is not working.
'm' is the positional marker / 'largetxt' the body that is being searched and 'smalltxt' is the string that is being searched for.
intx = InStr(m, mainTxt, smallTxt)
The variable 'smallTxt' is the problem ---- if I have: intx = InStr(m, mainTxt, "house") --- it works ok
Also ... same thing for: intx = largeTxt.IndexOf(smallTxt, m)
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim maintext AsStringDim smalltext AsStringDim foundpos AsIntegerDim startpos AsInteger'startpos = 6 'should test not found
startpos = 0'should test matched
maintext = "Jack and Jill"
smalltext = "and"
foundpos = maintext.IndexOf(smalltext, startpos)
If foundpos > 0Then'found
MsgBox("match found at character " & foundpos)
MsgBox("no match found")
Last Visit: 31-Dec-99 18:00 Last Update: 21-Dec-13 18:51