Strange Game Server's Port

Sep 29, 2014 at 4:51 PM
the main query to Steam Master Server return addresses and ports of all Game Servers. This is ok but I've noticed that the port retrieved from Master Server don't correspond to the real port of the Game Server. This is not an issue of this library, I think.

Then I've noticed that the Extra Flag, that could retrieve the real Game Server's port, is readed, in the library, but not memorized in the server.extra string (you can find it in Server.cs at line 125); maybe an issue?

BTW, great job on this library!!
Sep 29, 2014 at 6:32 PM
Edited Sep 30, 2014 at 2:29 PM
I have made some changes to the original code:
// Search for the Extra Flag information
    server.Extra = "";                  // Initialize the Extra Flag
    byte edf = parser.ReadByte();
    if ((edf & 0x80) > 0)
        server.Extra = server.Extra + "ServerPort=" + parser.ReadShort() +";";
    if ((edf & 0x10) > 0)
        server.Extra = server.Extra + "SteamID=" + parser.ReadInt() + ";";
    if ((edf & 0x40) > 0)
        server.Extra = server.Extra + "Port=" + parser.ReadShort() + ";Name=" + parser.ReadString() + ";";
    if ((edf & 0x20) > 0)
        server.Extra = server.Extra + "Keywords=" + parser.ReadString() + ";";
    if ((edf & 0x10) > 0)
        server.Extra = server.Extra + "GameID=" + parser.ReadInt();
catch (ParseException)
    // Do Nothing
    //server.Extra = "";
So, if the Extra Flag is found, it will return all the information contained in it. It even separate information with semi-column so it's more simple to split the entire server.Extra() string to found them.

Oct 3, 2014 at 8:46 AM
thank you for reporting it.Source code has been updated.
There is no need to add ";"

To parse information in Extra flag you could do something like this in your application
//its just pseudocode
string[] temp= server.Extra.Split('=');
  case "ServerPort" : //temp[1] is  server port number
  case "SteamID" : //temp[1] is server  steamid
  case "Port" : //extra flag contains spectator port no. and name.(Use Regex on server.Extra because 'name' may contain '=' )(Reg.Exp :  ^Port=([0-9]+)Name=(.+)$)
  case "Keywords" : //extra flag contains keywords.(Use Regex on server.Extra because 'Keywords' may contain '=')
  case "GameID" ://temp[1] is gameid
Oct 3, 2014 at 4:21 PM
Thank you betson.

I've inserted the semi-column because the server.Extra string often is in form:
ServerPort=2302SteamID=123456Port=34567GameID=12354678989 etc.
So, with your method, inside temp[0] we found "SteamID" but inside temp[1] we found "2302SteamID", in temp[2] we found "123456Port" and so, for me, is more simple to insert the semi-column.

Btw, thanks for your work!

Oct 13, 2014 at 4:59 PM
I've noticed that so many servers have more than one Extra flag. With your method, Betson, we can only view one flag. With my method, we can see all the Extra flags.
Oct 13, 2014 at 11:03 PM
Its been fixed.use the updated version.
Oct 14, 2014 at 1:24 PM
Great work Betson! As usual!

Oct 17, 2014 at 12:50 PM
Edited Oct 17, 2014 at 12:51 PM
Goliath86 wrote:
Great work Betson! As usual!

Thank you for the compliment :)