• Welcome to Valhalla Legends Archive.
 

[VB][Question] Stringlist, IE in 0x0B

Started by Don Cullen, September 12, 2005, 04:07 PM

Previous topic - Next topic

Don Cullen

QuoteMessage ID: 0x0B
Message Name: SID_GETCHANNELLIST 
Direction: Server -> Client (Received)

Format:

(STRINGLIST)    Channel names, terminated by a null string.

Remarks: Contains a list of available channels.

BNETDocs says stringlist, and I'm at a loss as to exactly what a stringlist is. Is a stringlist pretty much a single string and can be just put inside a string variable, or is there a different way stringlist is supposed to be handled?

Also, it says 'Terminated by a null string'-- is that in reference to EACH channel string being terminated by a null string, or the entire stringlist ENDING with a null string?

I'm lost... Thanks for any help, and for reading this!
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

Blaze

According to BNETDocs,

STRING     Null-terminated array of characters.
STRING[]     An array of strings (see above). This type is generally only used when another field in the packet specifies how many entries there are.
STRINGLIST    A series of strings (see above) with an additional null-terminator at the end.
Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

MyndFyre

To make this even more clear, let's go with the 3 strings "123", "456", "789".

If this were a string[], it would be represented in-memory (and in-packet) as:

31 32 33 00 34 35 36 00    37 38 39 00


Often, a memory or packet location will tell the reader how many strings there are.

If it were a string list, it would be:

31 32 33 00 34 35 36 00    37 38 39 00 00


Note the extra null character.  This tells a reader that it can stop reading.

And yes, I chose numerical digits because they're easy-to-remember codes.  :P
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.

Don Cullen

So, for STRINGLIST, I just read the string, and use CHR(0) as the delimiter when I use the Split function on it, then use a for next array to display each item in the array?
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

MyndFyre

For a stringlist I wouldn't use the Split() function.  I'd go with reading it in a stream-like fashion.
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.

Don Cullen

Quote from: MyndFyre on September 12, 2005, 07:13 PM
For a stringlist I wouldn't use the Split() function.  I'd go with reading it in a stream-like fashion.

Could you give an example, because I'm not really sure what you mean by 'steam-like fashion'?
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.