Hi, I am working on a simple application for a game which uses udp packets to broadcast its server. However, I am having some problems to decode the main packet:

byte[] buffer = { 247, 48, 157, 0, 80, 88, 51, 87, 23, 0, 0, 0, 25, 0, 0, 0, 246, 76, 228, 16, 76, 111, 99, 97, 108, 32, 71, 97, 109, 101, 32, 40, 74, 111, 104, 110, 110, 121, 41, 0, 0, 1, 3, 73, 7, 1, 1, 181, 1, 233, 117, 1, 61, 245, 5, 43, 77, 203, 97, 113, 115, 93, 69, 111, 119, 153, 111, 109, 111, 97, 101, 93, 77, 35, 97, 69, 33, 67, 97, 109, 109, 171, 115, 33, 65, 115, 101, 111, 97, 69, 33, 49, 47, 51, 49, 97, 47, 71, 119, 51, 121, 1, 75, 111, 105, 9, 111, 111, 121, 1, 1, 61, 117, 105, 153, 47, 45, 191, 105, 147, 41, 219, 223, 97, 65, 161, 149, 9, 131, 11, 251, 57, 127, 235, 0, 10, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0, 89, 0, 0, 0, 224, 23 };

What I need to retrieve from that packet is: 'player name' and 'map name'.

For the above byte array, the decoded information is:
-- 1. Local Game (Johnny)
-- 2. Maps\Download\MaD Balls Arena 1.20a.w3x

-- 1. The first one (player name) was easy to retrieve. I converted the byte array to string (Encoding.ASCII.GetString), then found the index of string "Local Game(".
-- 2. But for the 'map name', I cannot found a way to retrieve it. When I convert the byte array to string, the needed information is "here" but it is completely messed up.

Any help to decode this byte array please?
Or can someone try to retrieve the string "Maps\Download\MaD Balls Arena 1.20a.w3x" from the above byte array "buffer"?

----
P.S: Maybe this might help, A friend was able to retrieve the 'map name' by copying some bytes (with some conditions & calculations) from the byte array using 'MemoryStream'.

Just a guess because it's a common error: are you checking for "\\" (double backslash) when checking for the backslash char in your string (e.g. "Maps\\Download\\..."? Backslash is an escape code and you need two of them to translate literal.

This might help:

For me, I noticed that the string "M?aqs]Eow?omoae]" logically means "Maps\Download\".

This article has been dead for over six months. Start a new discussion instead.