• Welcome to Valhalla Legends Archive.
 

Infitate loop problem

Started by phvckmeh, November 08, 2004, 05:48 PM

Previous topic - Next topic

phvckmeh

Alright, well sometimes on my bot, like every couple hours, my bot will loop forever on this sub, i broke it and i marked where it broke too (while it was in a loop) My CPU goes up to 99% when its like this, and it just stays like that untill it crashes.

Any ideas?

Private Sub sckBnet_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next
  Dim strBuffer As String, strTemp As String, lngLen As Long
 
sckBNET.GetData strTemp, vbString

strBuffer = strBuffer & strTemp
While Len(strBuffer) > 4
'//Error
    If Left(strBuffer, 1) <> Chr(&HFF) Then
        Exit Sub
    End If

lngLen = Val("&H" & StrToHex(StrReverse(Mid(strBuffer, 3, 2))))

If Len(strBuffer) < lngLen Then Exit Sub

If ReadINI("Server", "USEBnls") = "1" Then
    ParseBNET2 (Left(strBuffer, lngLen))
Else
    ParseBNET (Left(strBuffer, lngLen))
End If

strBuffer = Mid(strBuffer, lngLen + 1)
Wend

UserLoser.

Note some BNCS packets have a length of four

Yegg

im not sur if this will help but heres my winsock dataarrival code (my bot uses hashes)

Private Sub wsBNET_DataArrival(ByVal bytesTotal As Long)
    On Error Resume Next
    Static strBuffer As String
    Dim strTemp As String, lngLen As Long
    wsBNET.GetData strTemp, vbString
    strBuffer = strBuffer & strTemp
    While Len(strBuffer) > 4
      lngLen = Val("&H" & StrToHex(StrReverse(Mid(strBuffer, 3, 2))))
      If Len(strBuffer) < lngLen Then Exit Sub
       parsep (Left(strBuffer, lngLen))
       
      strBuffer = Mid(strBuffer, lngLen + 1)
    Wend
   
   
End Sub

MyndFyre

QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Minux

#4
The funny thing about both of the codes provided is they both have


Val("&H" & StrToHex(StrReverse(Mid(strBuffer, 3, 2))))


Which points out they didn't write it themselves. And due to DarkMinion's packetbuffer's popularity, you would figure you would instead see


pBuffer.GetWORD(Mid$(strBuffer, 3, 2))


That is...if they really knew what they were doing :P

Banana fanna fo fanna

see the answer on www.clancybr.com

note: people who read the forum will get my joke :)