Obtaining a Rust server data.

1,177 views
Skip to first unread message

Yamiino

unread,
Jan 18, 2014, 1:21:13 PM1/18/14
to steam-c...@googlegroups.com
Man I love you for making this library.

I am making a website and required to obtain Rust server's information like server name, players online, and so on.

However I had a very bad headache from trying to figure out the library at first as I know a server's IP:Port, however when using SourceServer or GoldSrcServer to obtain it's information if I use the port that is used to connect to the server then the request will time out. Ended up having a typo entering +1 to the server port of a server and the data was retrieved.

Tested this same thing with several servers and it seems that to obtain the information, the port is different than what a player let's say would give others to connect to his/her server.

Now, I just wanted to confirm this. Is it always IP:(PORT+1)? Can that be changed or more like, is there a way to obtain the information from the original connection port?

I have listed all the servers available for rust with the following script:

$master = new MasterServer(MasterServer::GOLDSRC_MASTER_SERVER);
$servers = $master->getServers(MasterServer::REGION_ALL,"\\gamedir\\rust",false);
echo '<pre>';
print_r(($servers));
echo '</pre>';

That returns the ports with +1 from what we use to connect to the game, which is funny because the port to connect is never mentioned on this list.

The next, is an example of getting a server's information:

$server = new SourceServer('192.99.7.170:28076');
$server->initialize();
print_r($server->getServerInfo());

That IP and port are listed on the MasterServers, however what the user would type as his server to connect to it would be 192.99.7.170:28075

Is there any way to obtain the information from the port 28075? Or simply should stick to 28075+1?

Thank you!

Sebastian Staudt

unread,
Jan 19, 2014, 5:33:00 PM1/19/14
to steam-c...@googlegroups.com
Hi.

I don't know the specialities of Rust (I don't even know what version of the Source engine it is using).
Usually the ports returned by the master servers match the "game" ports that are used to connect to by game clients as well as the "query" ports used by Steam Condenser and other querying tools.

BTW you should not use GoldSrcServer (or the GoldSrc master server) if you're querying Source servers. Although it seems that this works currently (for some?) games and servers. It might change (again!) at any time.

Best regards,
Sebastian

Nicholas Hastings

unread,
Jan 19, 2014, 5:36:51 PM1/19/14
to steam-c...@googlegroups.com
Rust is not on the Source engine, but any game using Steamworks has the option to use the same query protocol since it's implemented in steamclient now (even for Source games).

Steamworks does support using a separate query port rather than having to pass it game traffic (like Source games do). Unfortunately, as noted, the master server doesn't provide it.

One other issue you'll encounter with Rust is that player counts are handled in the gamedata/tags since the query protocol only allows for a max of 255 for these values.

--
Nicholas Hastings

Sunday, January 19, 2014 5:33 PM
--
You received this message because you are subscribed to the Google Groups "Steam Condenser" group.
To unsubscribe from this group and stop receiving emails from it, send an email to steam-condens...@googlegroups.com.
To post to this group, send email to steam-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/steam-condenser/7ecc9f07-5ec7-4810-af1a-5a5bc492c103%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Saturday, January 18, 2014 1:21 PM

Yamiino

unread,
Jan 21, 2014, 4:06:58 AM1/21/14
to steam-c...@googlegroups.com
Thanks for the replies :)

Yeah it seems that I got it running, whenever it start getting timeouts/errors my database will tell me about it and will just change whatever is needed. Yeah that's a headache i had right there, having the correct info and being provided with a different info from master servers, simply made no sense at all lol.

But ah well, the game is on alpha right now, which I guess is one of the reasons of this happening, probably, i hope... yeah... lol.

Thanks again for the help! :)

Tim

unread,
Apr 8, 2014, 2:49:04 PM4/8/14
to steam-c...@googlegroups.com
Hey Yamiino,

What was your final solution to get this to work? Currently I'm using:

$server = new SourceServer('68.232.160.54:28017');
$server->initialize();
print_r($server->getServerInfo());

Im getting this error: Uncaught exception 'TimeoutException' with message 'The operation timed out.
Reply all
Reply to author
Forward
0 new messages