• Welcome to Valhalla Legends Archive.
 

Help with 0x0F EID 0x01

Started by Loud, July 19, 2005, 07:11 PM

Previous topic - Next topic

Loud

I've checked BNETDocs, and Developement resources already... I just have a basic lame question, because nobody I know can tell me ANYTHING about packets (all my programmer friends are on vacation).

Should 0x01 contain more than one user per packet? I got the impression from BNETDocs that it shouldn't but it does... Uhhh, thanks in advance.

Warrior

It doesn't send them all together but it will send that packet continuously per user.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Loud

Hmm, that's odd...
..<.........^...............CLaN-SoF10]SoF.3RAW 1R3W 0 dRoW...4.........................o4]SoF[.3RAW 1R3W 0 FoS...4.........^...............o1]SoF[.3RAW 1R3W 0 FoS...U.........^[email protected] 7190 116 12931 0 0 7304 1448 426 NB2W...F.........}[email protected] 0 0 0 0 0 0 0 0 [email protected] 0 0 0 0 0 0 0 0 [email protected] 0 0 3 0 0 0 0 0 PXES...F.........................DNX]SoF[@USWest.NB2W 0 0 0 0 0 0 0 0 NB2W...:.........m...............imaloser]sof[.3RAW 1R3W 0 FoS...=.........N...............RuM_N_CoKe]SoF[.3RAW 1R3W 1 dRoW...5.........?...............RuM_BoT]SoF[.3RAW 1R3W 0...4.........?...............o6]SoF[.3RAW 1R3W 0 FoS...I.........................I-DNX]SoF[@USWest.NB2W 0 0 40 0 0 0 0 0 NB2W...G.........................Loud]SoF[@USWest.RATS 0 0 0 0 0 0 0 0 RATS...4.........^...............o2]SoF[.3RAW 1R3W 0 FoS...4.........^...............o3]SoF[.3RAW 1R3W 0 FoS...;.........^...............ClaNSoF)1]SoF[.3RAW 1R3W 0 [email protected] 0 0 0 0 0 0 0 0 NB2W.

That is the text from the right (I am pretty newb at programming at the moment), and my logger claims it is all one packet. On EID 0x01 my bot SHOULD add the user enclosed in 0x01... But with shit like this, it just doesn't do it.

Any idea what's wrong? I am using BNCSUtility if that is of any use...

Hdx

#3
Give us a format output of it, including the hex value of it. What i think is happening is that you are simply get all those packets at once, and you need to seperate them out.
~-~(HDX)~-~

Edit, It seems that you are reciving these 18 packets:
..<.........^...............CLaN-SoF10]SoF.3RAW 1R3W 0 dRoW.
..4.........................o4]SoF[.3RAW 1R3W 0 FoS.
..4.........^...............o1]SoF[.3RAW 1R3W 0 FoS.
..U.........^[email protected] 7190 116 12931 0 0 7304 1448 426 NB2W.
..F.........}[email protected] 0 0 0 0 0 0 0 0 NB2W.
[email protected] 0 0 0 0 0 0 0 0 NB2W.
[email protected] 0 0 3 0 0 0 0 0 PXES.
..F.........................DNX]SoF[@USWest.NB2W 0 0 0 0 0 0 0 0 NB2W.
..:.........m...............imaloser]sof[.3RAW 1R3W 0 FoS.
..=.........N...............RuM_N_CoKe]SoF[.3RAW 1R3W 1 dRoW.
..5.........?...............RuM_BoT]SoF[.3RAW 1R3W 0.
..4.........?...............o6]SoF[.3RAW 1R3W 0 FoS.
..I.........................I-DNX]SoF[@USWest.NB2W 0 0 40 0 0 0 0 0 NB2W.
..G.........................Loud]SoF[@USWest.RATS 0 0 0 0 0 0 0 0 RATS.
..4.........^...............o2]SoF[.3RAW 1R3W 0 FoS.
..4.........^...............o3]SoF[.3RAW 1R3W 0 FoS.
..;.........^...............ClaNSoF)1]SoF[.3RAW 1R3W 0 FoS.
[email protected] 0 0 0 0 0 0 0 0 NB2W.

So Like I said, you need to split them up.
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Loud

I am not very apt at Visual Basic 6 right now, can you point me in the direction as to which I need to go to separate the recieved packets? I am not 100% sure what means you can do it by.

Sorry to be so needy, but I want my bot not to crash when a users leaves because they aren't found on the user list.

Hdx

http://bnetdocs.valhallalegends.com/content.php?Section=d&id=6
Check out the BNCS headers. Notice that it has a 'Length' section? Thats how you tell how to split it up. Just throw everything you recive into a incoming buffer (a string vareable) after you get it out of the winsock. Then while Len(Buffer) >=4 then 'get the lengeth and parse it. If the Lengeth in the header is longer then the current buffer, then wait for more to come.

It's not hard. As for crashing cusz it's not found in the userlist... thats jsut bad coding :/
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Loud

Lol, your solution sounds like it will work. Thanks for the commentary about my code to, that helps a lot... =/

Eric

#7
TCP/IP is a streaming protocol--data is sent and received in chunks.  This presents a problem: If data is being sent and received in chunks, how will you know when one message ends and another begins?  The answer to that question is an application-defined packet header which generally contains the length of the packet, and in some cases, additional information as well.  Battle.net's packet header is 4 bytes long and consists of the header ID (0xFF), the packet ID and the length of the packet.  You'll need to seperate each individual packet based on it's length before processing it.  Due to the fact that data is received in chunks, you may not always receive all of a packet at once, so you'll need to buffer the incoming data and wait for the rest of the packet to be received.  You may also encounter times where you receive multiple packets at once, as you have here.

Loud

I can't figure out how to throw all my data recieved into a string... (Yes, I suck at coding.)

Also, HDX, for your statement, where did you pull 4 from? Is that so that it checks the BNCS header...?

R.a.B.B.i.T

socket.GetData BufferString, vbString
I suggest you learn to program (that's VB6, btw).

Tontow

(BYTE)      Always 0xFF - 1 byte
(BYTE)      Message ID - 1 byte
(WORD)      Message length, including this header - 2 bytes
= 4 bytes

Loud

Yes, I'm back for more abuse (Thanks Rabbit I <3 you)...

Anyways, let me lay out this concept as I am percieving it, because I don't know if I am interpreting this correctly!

You are bascially saying, find out the length of the individual packet (That has been mashed wish several of the same type), extract that individual part, parse it, then continue on to the next part in the packet, until you have run out. Errr, is this correct?

If so, how do I dispose of the part(s) that I have dealt with?

I am newb, but I am thinking I should use something like this...

'Let's say, PacketToParse is what I am parsing...
PacketToParse = Mid(AllPacketText, PStart, PLength)


That is probably the completely incorrect way to do this, but it is all I can think up (Tired)... This method kind of screws me, because I don't know how to dispose of PacketToParse that has been parsed, because it will just continually parse the same part...

Uhhh, any suggestions, other than rabbit's "Learn to program"...

Arta

When you have parsed the the packet -- which, by the way, should correctly be named a message -- you move the rest of the buffer back according to the length of the message you parsed.

For example, if you parse a message 20 bytes long, you would move all of the data in the buffer backwards by 20 bytes. I'm not a VB programmer, so this will not be written correctly, but the concept is what's important:


' extract a message for parsing
PacketToParse = Mid(AllPacketText, PStart, PLength)

' reset the buffer
AllPacketText = Mid(AllPacketText, PLength, Length(AllPacketText) - PLength)

Loud


' reset the buffer
AllPacketText = Mid(AllPacketText, PLength, Length(AllPacketText) - PLength)

Subtracting PLength from Len(AllPacketText), I am unsure about that... Wouldn't it remove from the (for lack of a better term) bottom of the packet...? I know you aren't a VB programmer, but maybe somebody that is can clarify that.