Send Steam Query

Yeah, you will need to send the raw bytes for the query. Since they give the query structure in hex you will simply need to convert it to standard bytes.

Here's a method I came up with to do that:
C#:
private byte[] GetBytes(string hex)
{
    System.Collections.Generic.List<byte> bytes = new List<byte>();

    foreach (string hexChunk in System.Text.RegularExpressions.Regex.Split(hex.Trim(), @"\s+"))
    {
        bytes.Add((byte)Int32.Parse(hexChunk, System.Globalization.NumberStyles.HexNumber));
    }

    return bytes.ToArray();
}
Example call:
C#:
foreach (byte b in GetBytes("FF FF FF FF 55"))
{
    System.Diagnostics.Debug.WriteLine(b);
}
Once you figure out the byte structure you can just hard code the queries like the following:
C#:
byte[] detailsQuery = new byte[] { 255, 255, 255, 255, 54 };
byte[] rulesQuery = new byte[] { 255, 255, 255, 255, 86 };
byte[] playersQuery = new byte[] { 255, 255, 255, 255, 85 };

You can then just send the query like the following:
C#:
mySocket.Send(detailsQuery);
You will get back a stream of bytes that is structured as they described on that page. Reading it should be easy. The only tricky part will be the strings.
 
Back
Top