• Welcome to Valhalla Legends Archive.
 

0x6c

Started by Arthas, December 28, 2003, 06:35 PM

Previous topic - Next topic

Arthas


Arta

Client? Protocol? Context?

UserLoser.

Assuming you recieved it - Where did you recieve it?  What did you do before you recieved it?  What product, ect... (what Arta said)

Arthas

Just wondering, I cant find it on bnet docs.

Sent 0x65, later received 0x6c upon login. Clinet = 3raw, protocol?... TCP.

UserLoser.

That'd be game protocol, 1 = game, 2 = ftp, 3 = chat

Arthas

battle.net bot development forum, right?....

Nevermind, I made a typo in my code so that when I received split-packets it only parsed the first part of the packet...... Now my bot freezes, yay~!

Here's the code, see if you can tell me what the heck is going wrong here...


       sckBnet.GetData strTemp, vbString
       strBuffer = v1 + strBuffer & strTemp
       While Len(strBuffer) > 4
           lngLen = v2 + Asc(Mid(strBuffer, 3, 1)) + Asc(Mid(strBuffer, 4, 1)) * 256
           If Len(strBuffer) < lngLen Then
               v1 = strBuffer
               v2 = lngLen
               Exit Sub
           End If
           If Not Mid(StrToHex(strBuffer), 1, 2) = "FF" Then
               v1 = strBuffer
               v2 = lngLen
               Exit Sub
           End If
           Parse (Left(strBuffer, lngLen))
           strBuffer = Mid(strBuffer, lngLen + 1)
       Wend

Grok

Ten gazillion examples of using VB to parse binary network data, battle.net protocol, and we still see code like that.  Hmm.  I advise separating the buffer writing from the buffer reading.  As someone else has pointed out, your While Len(buffer)>4 is a problem.  Some packets are 4 bytes only, and you won't parse them timely.

Arthas

Maybe I just need a better example...... lol

I changed my while len(buffer) > 4 to >= 4, better?

I need t know of a better method of joining two split packet together. Btw v1 and v2 are public variables for the form I am using this code in.  Any ideas...?