[0.13.4] Rcon commands

Bugs that are actually features.
illmaren
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Jun 27, 2016 3:25 pm
Contact:

[0.13.4] Rcon commands

Post 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
Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [0.13.4] Rcon commands

Post 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.
illmaren
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Jun 27, 2016 3:25 pm
Contact:

Re: [0.13.4] [Pending] Rcon commands

Post 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)

Image
My Server is "! Fun Gaming !" runs on an dedicated machine
to see the whole rcon thing go to http://illmaren.de/factorio/
Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [0.13.4] Rcon commands

Post 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.
illmaren
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Jun 27, 2016 3:25 pm
Contact:

Re: [0.13.4] Rcon commands

Post 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?
Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [0.13.4] Rcon commands

Post 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.
Post Reply

Return to “Not a bug”