Page 1 of 1
[0.13.4] Rcon commands
Posted: Tue Jul 05, 2016 1:46 am
by illmaren
If:
- Someone is joining the server
- Someone is leaving the server
- the server saves
- a player desyncs
- or if some other thing happens which lets the server load
rcon commands send dont get anything in return.
Example if i send the /p command to get the playerlist i get nothing in return but an error:
Code: Select all
Rcon read: Failed to read any data from socket
Nothing huge but still an bug in my opinion.
Greetz
Illmaren
Re: [0.13.4] Rcon commands
Posted: Mon Jul 11, 2016 1:46 pm
by Oxyd
So how do I reproduce this? What RCON client are you using?
Moving out of confirmed since there's no clear way to reproduce.
Re: [0.13.4] [Pending] Rcon commands
Posted: Mon Jul 11, 2016 5:35 pm
by illmaren
I´m using the xPaw PHP RCON envirorment.
1. etablish and add everything
2. Send an command (for example /p )
3. Display the output.
Code: Select all
<?
$Query = new SourceQuery( );
try
{
$Query->Connect( $config[$i]['addr'], $config[$i]['port'], $config[$i]['timeout'], SourceQuery::SOURCE );
$Query->SetRconPassword( $config[$i]['password'] );
$server[$i]['player-count'] = ($Query->Rcon( '/p' ));
}
catch( Exception $e )
{
echo $e->getMessage( );
}
finally
{
$Query->Disconnect( );
}
?>
as you can probaly see its in a loop $i indicates an array where my server data are saved in.
$server[$i]['player-count'] is the output (online people are later in the code counted)

My Server is "! Fun Gaming !" runs on an dedicated machine
to see the whole rcon thing go to
http://illmaren.de/factorio/
Re: [0.13.4] Rcon commands
Posted: Wed Aug 03, 2016 2:35 pm
by Oxyd
Still can't reproduce. I cloned
the repository onto my machine, and created a file Examples/Foo.php with the following contents:
Code: Select all
<?php
require __DIR__ . '/../SourceQuery/bootstrap.php';
use xPaw\SourceQuery\SourceQuery;
// For the sake of this example
Header( 'Content-Type: text/plain' );
Header( 'X-Content-Type-Options: nosniff' );
// Edit this ->
define( 'SQ_SERVER_ADDR', 'localhost' );
define( 'SQ_SERVER_PORT', 4444 );
define( 'SQ_TIMEOUT', 1 );
define( 'SQ_ENGINE', SourceQuery::SOURCE );
// Edit this <-
$Query = new SourceQuery( );
try
{
$Query->Connect( SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE );
$Query->SetRconPassword( 'pants' );
var_dump($Query->Rcon( '/p' ));
}
catch( Exception $e )
{
echo $e->getMessage( );
}
finally
{
$Query->Disconnect( );
}
Then I ran it and got the correct reply:
Code: Select all
[ivy] ~/devel/PHP-Source-Query/Examples % php Foo.php
string(23) "Players:
Oxyd
mp-1
"
So, again, can't reproduce. Not sure how this bug is “confirmed” again either.
Re: [0.13.4] Rcon commands
Posted: Thu Aug 04, 2016 7:00 am
by illmaren
and as you loaded the script foo.php you had something going on at the server? like a player joining or a player loading the map after desync?
Re: [0.13.4] Rcon commands
Posted: Thu Aug 04, 2016 10:22 am
by Oxyd
No, the server was idle. When a player is loading a map, or any of the other things you mentioned is going on, the game is basically stopped and the server can't process the RCON command until the player finishes joining or leaving. As soon as the player is finished joining, the server will process the command and send a reply back.
Which seems to explain your issue here – the PHP library will assume that the connection has broken if the reply doesn't come within the given timeout period. If the timeout is too low, it's possible that the library will give up before the player has finished joining. If you increase the timeout, it works just fine.
Maybe the upcoming multiplayer changes will make it possible to reply to RCON commands immediatelly even when someone is joining. For now, this is not a bug.