• Welcome to Valhalla Legends Archive.
 

0x00 (Null) = ASCII 3 + ASCII 0 + ASCII 0???

Started by Luxer, August 19, 2004, 01:14 PM

Previous topic - Next topic

Luxer

After running BNLS querys though a BNLS tester, I discover how easy packets are.. But, what truley confuses me is that the first 0 is 0x00 is ASCII 3... Also, in 0x01 (Cdkey I hope) The first zero is ASCII 16? Also, why are there 4 ASCII 0 between the packets "flag" and the contents?

Yoni

Could you rephrase your question in a way that doesn't cause parser errors?

Luxer

Assumeing that you mean you can't read my post, sure.

How do I figure the ASCII value of the first number of a packet flag? For example:

0x00 (Null)

First Zero: ASCII 3
Second Zero: ASCII 0
Third Zero: ASCII 0

If you still have no idea that I am talking about, forget it and I will just figure it out.

Yoni

I think you are confused by the BNLS protocol spec.
Let me clear it up for you.

http://yoni.valhallalegends.com/BNLSProtocolSpec.txt

Have a look under "BNLS General Info".

BNLS message format:

(WORD) Message size, including this 3-byte header
(BYTE) Message ID
(....) Message-dependant data


Every message has a 3-byte header as explained above.

The two bytes of any message therefore represent the size of the message, in bytes.

For example, the BNLS_NULL (0x00) message contains no data. Therefore, the size of any BNLS_NULL message is exactly 3 bytes - the header only.

The first two bytes (length) therefore receive the value 3.
Written in hex: 0x0003
In little endian: 0x03, 0x00
So the first byte is 3, the second is 0.

The third byte is the ID. BNLS_NULL has ID 0x00. So the third byte is 0.

Complete message:
03 00 00

Luxer

Ahhh... Thanks. So the first character of my packets should be the packets length?

Yoni

No, the first 2 bytes. In little endian format.

For example if the length is 0xABCD, then the first byte should be 0xCD, and the second should be 0xAB.