AtomicChip
Programmer
I'm wondering if anybody else has run across this and found out whether or not this is an actual .NET issue, or if it's just another one of those PEBKAC (Problem Exists Between Keyboard And Chair) issues.
I recently created a little class to query Counter Strike (yeah, geeky I know) servers. Each of the server commands are prefixed with 0xff 0xff 0xff 0xff. If I create a byte array like this:
... when this is sent over a socket, there isn't an issue. However, I'm lazy and I don't want to create a byte array like this for each and every command. So, I tried doing this:
It seems that when the conversion is done here, the \xff's are actually converted to \x3f's.
I did the exact same thing in Python ("\xff\xff\xff\xffCOMMAND\x00") and it works fine.
.NET issue, or PEBKAC?
Anyone?
-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
I recently created a little class to query Counter Strike (yeah, geeky I know) servers. Each of the server commands are prefixed with 0xff 0xff 0xff 0xff. If I create a byte array like this:
Code:
byte[] b = { 0xff, 0xff, 0xff, 0xff, (Rest of the command here) };
... when this is sent over a socket, there isn't an issue. However, I'm lazy and I don't want to create a byte array like this for each and every command. So, I tried doing this:
Code:
byte[] b = System.Text.ASCIIEncoding.ASCII.GetBytes("\xff\xff\xff\xffCOMMAND\x00");
It seems that when the conversion is done here, the \xff's are actually converted to \x3f's.
I did the exact same thing in Python ("\xff\xff\xff\xffCOMMAND\x00") and it works fine.
.NET issue, or PEBKAC?
Anyone?
-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy