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
Note some BNCS packets have a length of four
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
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
see the answer on www.clancybr.com
note: people who read the forum will get my joke :)