felixms / arma-rcon-class-php

A lightweight client for sending commands easily to a BattlEye server.
MIT License
46 stars 22 forks source link

Chat stream not constant #30

Closed steffalon closed 6 years ago

steffalon commented 6 years ago

Hey, do I have to use getSocket() function to get the chat/rcon logs? I know it will return a stream resource but how do I make it constant? I have tried to use reactphp loops/streams but it looks like when I ran getSocket() every time it will only send it once and not the whole stream. I only get "logged in" responds but then it stops executing further. Do I have to change something to keep it constantly connected?

nerdalertdk commented 6 years ago

Gettings Chat/log is not supported out of the box

https://github.com/schaeferfelix/arma-rcon-class-php/issues/19 https://github.com/schaeferfelix/arma-rcon-class-php/issues/2

felixms commented 6 years ago

As @nerdalertdk already pointed out, this is quite difficult to realise. You need to acknowledge and validate the response from the server in order to keep the connection alive, see #18 and #16.

steffalon commented 6 years ago

Well I maybe have found something interesting. I have found another Github repository but written in Python script. See repository here. Maybe we can make it kinda the same in PHP. Here they keep having their constant connection with the server.

felixms commented 6 years ago

Feel free to contribute to this project! I currently don't have much time in my spare time, so anything regarding this issue must be done by someone else. But keep in mind, that the rcon client must acknowledge all received packages and send an empty package every x seconds to the server, in order to keep the connection alive. That's why I skipped this issue some time ago, because it's far beyond the scope of this library.

steffalon commented 6 years ago

I have good news, I made some progress but its still in development. Its a mess right now but the for loop keeps waiting for user input, only when someone said something, it keeps refreshing on the same message and can timeout. But it won't time out if there is no output from the server.

`//Settings
$pass = "[PASS HERE]";
$ip = "[IP HERE]";
$port = [PORT HERE];

$text = '';

$msgseq = 0;

//Generate CRC32 for pass and msg
$authCRC = crc32(chr(255).chr(00).trim($pass));
$authCRC = sprintf("%x", $authCRC);
$msgCRC = crc32(chr(255).chr(01).chr(hexdec(sprintf('%01b',$msgseq))).$text);
$msgCRC = sprintf("%x", $msgCRC);
//Reverse the CRCs and put into array
$authCRC = array(substr($authCRC,-2,2),substr($authCRC,-4,2),substr($authCRC,-6,2),substr($authCRC,0,2));
$msgCRC = array(substr($msgCRC,-2,2),substr($msgCRC,-4,2),substr($msgCRC,-6,2),substr($msgCRC,0,2));

//Socket comm
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);

if(!$sock)
{
    die("Socket create failed: ".socket_last_error()."\n");
} else {
    echo "Got Socket!\n";
}

//header
$loginmsg = "BE".chr(hexdec($authCRC[0])).chr(hexdec($authCRC[1])).chr(hexdec($authCRC[2])).chr(hexdec($authCRC[3]));
//Add payload
$loginmsg .= chr(hexdec('ff')).chr(hexdec('00')).$pass;
$len = strlen($loginmsg);

echo "Attempting Login\n";
$sent = socket_sendto($sock, $loginmsg, $len, 0, $ip, $port);

if($sent == false)
{
    die("failed to send login ".socket_last_error()."\n");
} else {
    echo "Login sent: ".$sent." bytes\n";
}

socket_recvfrom($sock, $buf, 64, 0, $ip, $port);
//var_dump($buf);
if(ord($buf[strlen($buf)-1]) == 1)
{
    echo "Login Successful!\n";
} else if(ord($buf[strlen($buf)-1]) == 0) {
    echo "Login Failed!\n";
} else {
    echo "Unknown result from login!\n";
    exit;
}

//Send a heartbeat packet
$statusmsg = "BE".chr(hexdec("7d")).chr(hexdec("8f")).chr(hexdec("ef")).chr(hexdec("73"));
$statusmsg .= chr(hexdec('ff')).chr(hexdec('02')).chr(hexdec('00'));
$len = strlen($statusmsg);

for (;;) {
    socket_sendto($sock, $statusmsg, $len, 0, $ip, $port);
    $recv = socket_recvfrom($sock, $buf, 64, 0, $ip, $port);
    if($recv == false)
    {
        die("failed to recv ".socket_last_error()."\n");
    } else {
        //echo "Recieved: ".$recv." bytes\n\n";
        null;
    }
    echo substr($buf,9)."\n";
    socket_sendto($sock, $statusmsg, $len, 0, $ip, $port);
}
`

# [EDIT] You can already do chat logging by doing this: Keep in mind that this methode isn't very efficient!

`

//Settings
$pass = "[PASS HERE]";
$ip = "[IP HERE]";
$port = [PORT HERE];
$text = '';

$msgseq = 0;

//Generate CRC32 for pass and msg
$authCRC = crc32(chr(255).chr(00).trim($pass));
$authCRC = sprintf("%x", $authCRC);
$msgCRC = crc32(chr(255).chr(01).chr(hexdec(sprintf('%01b',$msgseq))).$text);
$msgCRC = sprintf("%x", $msgCRC);
//Reverse the CRCs and put into array
$authCRC = array(substr($authCRC,-2,2),substr($authCRC,-4,2),substr($authCRC,-6,2),substr($authCRC,0,2));
$msgCRC = array(substr($msgCRC,-2,2),substr($msgCRC,-4,2),substr($msgCRC,-6,2),substr($msgCRC,0,2));

//Socket comm
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);

//header
$loginmsg = "BE".chr(hexdec($authCRC[0])).chr(hexdec($authCRC[1])).chr(hexdec($authCRC[2])).chr(hexdec($authCRC[3]));
//Add payload
$loginmsg .= chr(hexdec('ff')).chr(hexdec('00')).$pass;
$len = strlen($loginmsg);

$sent = socket_sendto($sock, $loginmsg, $len, 0, $ip, $port);

if($sent == false)
{
    die("failed to send login ".socket_last_error()."\n");
}

socket_recvfrom($sock, $buf, 64, 0, $ip, $port);

//Send a heartbeat packet
$statusmsg = "BE".chr(hexdec("7d")).chr(hexdec("8f")).chr(hexdec("ef")).chr(hexdec("73"));
$statusmsg .= chr(hexdec('ff')).chr(hexdec('02')).chr(hexdec('00'));
$len = strlen($statusmsg);

for ($i = 0; $i <= 1; $i++) {
    $recv = socket_recvfrom($sock, $buf, 64, 0, $ip, $port);
    if($recv == false)
    {
        die("failed to recv ".socket_last_error()."\n");
    } else {
        if ($i == 1) {
            echo substr($buf,9)."\n";
        }
    }
    socket_sendto($sock, $statusmsg, $len, 0, $ip, $port);
}

socket_close($sock);

`
steffalon commented 6 years ago

I think I miss the acknowledge respond. Not sure tho. But I can't figure it out how to acknowledge my request. https://www.battleye.com/downloads/BERConProtocol.txt

steffalon commented 6 years ago

Does anyone have an idea how to send a acknowledge code to the Battleye server? I have still no clue what kind of values I have to send to the server.

nerdalertdk commented 6 years ago

Might be worth the take al look here https://github.com/marceldev89/BattleNET

https://github.com/marceldev89/BattleNET/blob/master/BattleNET/BattlEyeClient.cs#L227

case BattlEyePacketType.Acknowledge:
type = Helpers.Hex2Ascii("FF02");
0FakE commented 6 years ago

@steffalon Did you find a solution for this already?

I would really like to use the possibility of a constant connection to the server. To recive the status messages and to send commands to the server.

steffalon commented 6 years ago

Hey @0FaKE , well I haven't found it yet.

@nerdalertdk it seems its a heartbeat respond and looks similar like this:

Helpers.Hex2Ascii("FF02") ==

$statusmsg = "BE".chr(hexdec("7d")).chr(hexdec("8f")).chr(hexdec("ef")).chr(hexdec("73"));
$statusmsg .= chr(hexdec('ff')).chr(hexdec('02')).chr(hexdec('00'));
$len = strlen($statusmsg);
socket_sendto($sock, $statusmsg, $len, 0, $ip, $port);

This is interesting. If I remove the heartbeat socket_sendto call in the for loop that I have posted a few weeks ago, it will time out if I login in server (first message from socket), because it gives me a logon message via socket. But calling the heartbeat will wait until the second respond and then it will timeout. I have no clue what I should do next. I thought the socket is still waiting for a acknowledge responds but if I call the heartbeat socket_sendto again, it wont do it.

1x respond (only let you know that you are logged in)

for (;;) {
   $recv = socket_recvfrom($sock, $buf, 64, 0, $ip, $port);
   if($recv == false)
   {
      die("failed to recv ".socket_last_error()."\n");
   } else {
      //echo "Recieved: ".$recv." bytes\n\n";
   }
   echo substr($buf,9)."\n";
   //socket_sendto($sock, $statusmsg, $len, 0, $ip, $port); ----- without heartbeat call
}

2x respond (Possible to see chat or someone else logged in or kick/ban messages) but will timeout again. Heartbeat call doesn't work anymore.

for (;;) {
   $recv = socket_recvfrom($sock, $buf, 64, 0, $ip, $port);
   if($recv == false)
   {
      die("failed to recv ".socket_last_error()."\n");
   } else {
      //echo "Recieved: ".$recv." bytes\n\n";
   }
   echo substr($buf,9)."\n";
   socket_sendto($sock, $statusmsg, $len, 0, $ip, $port);
}
nerdalertdk commented 6 years ago

Have you checked your php max_execution_time ?

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 300

Can see there is no limit if you run in cli

0FakE commented 6 years ago

@nerdalertdk

The execution time isn't the problem here.

It's also strange the loop ends exactly after an output of 6 rows, always. I guess the heartbeat sending or acknowledging isn't working however...

I'm reciving my own login message and one more server message.

RCon admin #3 (xx.xx.xx.xx:61993) logged in (Side) abgas: if we want to win stop para's all pilot snow (Side) abgas: if we want to win stop para's all pilot snow (Side) abgas: if we want to win stop para's all pilot snow (Side) abgas: if we want to win stop para's all pilot snow (Side) abgas: if we want to win stop para's all pilot snow

It should usually recive server messages continuesly but the loop will only recive 2, always. The own successful login and one server message after.

And it will loop the 2nd respond cause the RCon timed out already.

steffalon commented 6 years ago

@nerdalertdk I'm using a command line. Its giving me a 0 in ini_get.

@0FaKE I think its because it didn't acknowledge the second one successfully. First time does for some reason. Battleye will do this if it fails to respond:

The server's BE RCon tries to send a server message packet 5 times for 10 seconds. If the client fails to acknowledge the packet within this time, it will be removed from BE RCon's list of authenticated clients and will no longer be able to issue any commands.

Source: https://www.battleye.com/downloads/BERConProtocol.txt

0FakE commented 6 years ago

@steffalon Something new already about the acknowledge issue?

Btw. something which isn't working also is the fact you can't even send commands to the server.

Your variable $text = '' is completly ignoring sent commands.

It seems like it's also not possible to recive direct answers from BE. For example send a RCon command like commands won't give you an answer.

steffalon commented 6 years ago

@0FaKE sorry for the late answer. I didn't make any progress of solving this issue. The thing is, I did something that in the first loop, it acknowledge the data but doing the same process again won't do it. I have no clue why this isn't working the second time. Heartbeat respond is correct but second time its not doing anything.

nerdalertdk commented 6 years ago

Maybe this could help ? if it works with amphp/amp we should make it as an WIKI article and not merge it

https://www.sitepoint.com/modding-minecraft-with-php-buildings-from-code

steffalon commented 6 years ago

@nerdalertdk I'm going to investigate how that library works. But I also found this from ampphp: https://github.com/amphp/socket/tree/13341decaa12f4f264869bdb94fc0dc770aaa784. This is getting very interesting.

0FakE commented 6 years ago

Just figured out now the issue is definitly about acknowledging the packets betweens server to client and the "heartbeat" itself.

Like we know the server accepts the heartbeat message only once a time and will timeout the client 10s later even if he sends the heartbeat again.

@steffalon

So you should ask yourself how to acknowledge status messages from server to client.

Still found no answer for this issue.

I've share the issue on StackOverflow - maybe anybode has a helpful idea.

https://stackoverflow.com/questions/47929125/php-client-acknowledge-battleye

steffalon commented 6 years ago

I found a NodeJS script version and that is a constant connection with command line interface. See here. Maybe this will help our research.

steffalon commented 6 years ago

Big news! I found the problem. Its the code of the acknowledge package that keep changing after the first time. I have noticed it uses an algorithm (so every time that you login, has same fomulier steps). Let me explain it better on the examples.

Here, for example:

First run in NodeJS:

Connected!
<Buffer 02 00>
<Buffer 42 45 7d 8f ef 73 ff 02 00>
RCon admin #2 (217.63.234.165:54802) logged in
<Buffer 02 01>
<Buffer 42 45 eb bf e8 04 ff 02 01>
RCon admin #0: (Global) [steffalon] test
<Buffer 02 02>
<Buffer 42 45 51 ee e1 9d ff 02 02>
RCon admin #0: (Global) [steffalon] test2
<Buffer 02 03>
<Buffer 42 45 c7 de e6 ea ff 02 03>
RCon admin #0: (Global) [steffalon] test3

Second run in NodeJS:

Connected!
<Buffer 02 00>
<Buffer 42 45 7d 8f ef 73 ff 02 00>
RCon admin #2 (217.63.234.165:54802) logged in
<Buffer 02 01>
<Buffer 42 45 eb bf e8 04 ff 02 01>
RCon admin #0: (Global) [steffalon] test
<Buffer 02 02>
<Buffer 42 45 51 ee e1 9d ff 02 02>
RCon admin #0: (Global) [steffalon] test2
<Buffer 02 03>
<Buffer 42 45 c7 de e6 ea ff 02 03>
RCon admin #0: (Global) [steffalon] test3

<Buffer 42 45 c7 de e6 ea ff 02 03>

42 52 = BE

c7 de e6 ea = Generated by formula

ff = keeps static

02 = static so the server knows its a respond code

03 = ever time add +1 (Like 00 at first time. Then 01 and then 02 etc.) after the 2 login messages.

Conlusion:

We have to find out how we are going to make the formula. Its already written in this NodeJS repository that I have send it as an example.


This might be "keep alive" code that is needed every 45 seconds or less. This is not for server messages!



 $statusmsg = "BE".chr(hexdec("be")).chr(hexdec("dc")).chr(hexdec("c2")).chr(hexdec("58"));
 $statusmsg .= chr(hexdec('ff')).chr(hexdec('01')).chr(hexdec('00'));
steffalon commented 6 years ago

Hello participants and developers!

After the theory that I was telling last time, helped me alot and I can even make it to work! I am using ReactPHP library but its not required. But using this code with ReactPHP, you can write commands in the commandline and the structure makes it more readable for developers. So here you go! Realtime socket listener that won't disconnect! This could be inplemented to this project.

require 'vendor/autoload.php';

error_reporting(~E_WARNING);

$pass = "PASSWORD";
$ip = "IP";
$port = PORT;

$msgseq = 0;
$firsttime = true;

//Generate CRC32 for pass and msg
$authCRC = crc32(chr(255).chr(00).trim($pass));
$authCRC = sprintf("%x", $authCRC);
//Reverse the CRCs and put into array
$authCRC = array(substr($authCRC,-2,2),substr($authCRC,-4,2),substr($authCRC,-6,2),substr($authCRC,0,2));

$loginmsg = "BE".chr(hexdec($authCRC[0])).chr(hexdec($authCRC[1])).chr(hexdec($authCRC[2])).chr(hexdec($authCRC[3]));
$loginmsg .= chr(hexdec('ff')).chr(hexdec('00')).$pass;

$loop = React\EventLoop\Factory::create();
$factory = new React\Datagram\Factory($loop);
$source = new React\Stream\ReadableResourceStream(fopen('php://stdin', 'r'), $loop);

$factory->createClient($ip.":".$port)->then(function (React\Datagram\Socket $client) use($loop, $loginmsg, $source) {
    $client->send($loginmsg); //Login packet send here!

    $source->on('data', function ($msg) use($client) {
        global $msgseq;
        $msgseq --;
        $msgCRC = crc32(chr(255).chr(01).chr(hexdec(sprintf('%01b',0))).$msg);
        $msgCRC = sprintf("%x", $msgCRC);
        $msgCRC = array(substr($msgCRC,-2,2),substr($msgCRC,-4,2),substr($msgCRC,-6,2),substr($msgCRC,0,2));
        $saymsg = "BE".chr(hexdec($msgCRC[0])).chr(hexdec($msgCRC[1])).chr(hexdec($msgCRC[2])).chr(hexdec($msgCRC[3]));
        $saymsg .= chr(hexdec('ff')).chr(hexdec('01')).chr(hexdec(sprintf('%01b',0))).$msg;
        $client->send($saymsg);
        $needBuffer = chr(hexdec('ff')).chr(hexdec('02')).chr(hexdec("00"));
        $needBuffer = hash("crc32b", $needBuffer);
        $needBuffer = str_split($needBuffer, 2);
        $needBuffer = array_reverse($needBuffer);
        $statusmsg = "BE".chr(hexdec($needBuffer[0])).chr(hexdec($needBuffer[1])).chr(hexdec($needBuffer[2])).chr(hexdec($needBuffer[3]));
        $statusmsg .= chr(hexdec('ff')).chr(hexdec('01')).chr(hexdec("00"));
        $client->send($statusmsg);
    });

    $client->on('message', function($message) use ($client) {
        echo substr($message,9). PHP_EOL;

        global $msgseq;
        global $firsttime;

        if ($firsttime) {
            $statusmsg = "BE".chr(hexdec("7d")).chr(hexdec("8f")).chr(hexdec("ef")).chr(hexdec("73"));
            $statusmsg .= chr(hexdec('ff')).chr(hexdec('02')).chr(hexdec(sprintf('00')));
            $client->send($statusmsg);
            $firsttime = false;
        } else {
            $needBuffer = chr(hexdec('ff')).chr(hexdec('02')).chr(hexdec(sprintf('%2X', $msgseq)));
            $needBuffer = hash("crc32b", $needBuffer);
            $needBuffer = str_split($needBuffer, 2);
            $needBuffer = array_reverse($needBuffer);
            $statusmsg = "BE".chr(hexdec($needBuffer[0])).chr(hexdec($needBuffer[1])).chr(hexdec($needBuffer[2])).chr(hexdec($needBuffer[3]));
            $statusmsg .= chr(hexdec('ff')).chr(hexdec('02')).chr(hexdec(sprintf('%2X', $msgseq)));
            $client->send($statusmsg);
            $msgseq ++;
        }
    });

    $client->on('error', function() {
        echo 'Something went wront...' . PHP_EOL;
    });

    $loop->addPeriodicTimer(25, function () use($client) {
        global $msgseq;
        $msgseq --;
        echo '--Keep connection alive--' . PHP_EOL;
        $keepalive = "BE".chr(hexdec("be")).chr(hexdec("dc")).chr(hexdec("c2")).chr(hexdec("58"));
        $keepalive .= chr(hexdec('ff')).chr(hexdec('01')).chr(hexdec(sprintf('00')));
        $client->send($keepalive);
    });
 });

 $loop->run();
felixms commented 6 years ago

First of all, congratulations! 🎉 Good work on this issue by all contributors. Thank you all for your work and sharing your knowledge, so other developers can use your code and contribute too! I'm always amazed by the power of open source! ❤️

if it works with amphp/amp we should make it as an WIKI article and not merge it

As @nerdalertdk already suggested, I think adding a Wiki article for this issue would be appropriate. Furthermore we can reference this article in the README. So in the future, developers having the same question, will know, how to get started.

But I am open for any other opinion - maybe adding methods to the class, which will simplify the procedure above?

steffalon commented 6 years ago

I found only 1 bug, if I send [players] command, the next acknowledge will fail. I'm finding out what I can do.

@schaeferfelix maybe you could add a function called listenToSocket() and if the user want to get out of the loops (ReactPHP) is to type "exit". We have to comment the code and do alot of cleanup.

steffalon commented 6 years ago

I found the problem. For "some" if there are many people, and you say "players", you need to make an other step backwards with the sequence.

Also, here is a small fix that sequence isn't going to negative.

require 'vendor/autoload.php';

error_reporting(~E_WARNING);

$pass = "PASSWORD";
$ip = "IP";
$port = PORT;

$msgseq = 0;
$firsttime = true;

//Generate CRC32 for pass and msg
$authCRC = crc32(chr(255).chr(00).trim($pass));
$authCRC = sprintf("%x", $authCRC);
//Reverse the CRCs and put into array
$authCRC = array(substr($authCRC,-2,2),substr($authCRC,-4,2),substr($authCRC,-6,2),substr($authCRC,0,2));

$loginmsg = "BE".chr(hexdec($authCRC[0])).chr(hexdec($authCRC[1])).chr(hexdec($authCRC[2])).chr(hexdec($authCRC[3]));
$loginmsg .= chr(hexdec('ff')).chr(hexdec('00')).$pass;

$loop = React\EventLoop\Factory::create();
$factory = new React\Datagram\Factory($loop);
$source = new React\Stream\ReadableResourceStream(fopen('php://stdin', 'r'), $loop);

$factory->createClient($ip.":".$port)->then(function (React\Datagram\Socket $client) use($loop, $loginmsg, $source) {
    $client->send($loginmsg); //Login packet send here!

    $source->on('data', function ($msg) use($client) {
        global $msgseq;
        if ($msgseq !== 0) {
             $msgseq --;
        }
        $msgCRC = crc32(chr(255).chr(01).chr(hexdec(sprintf('%01b',0))).$msg);
        $msgCRC = sprintf("%x", $msgCRC);
        $msgCRC = array(substr($msgCRC,-2,2),substr($msgCRC,-4,2),substr($msgCRC,-6,2),substr($msgCRC,0,2));
        $saymsg = "BE".chr(hexdec($msgCRC[0])).chr(hexdec($msgCRC[1])).chr(hexdec($msgCRC[2])).chr(hexdec($msgCRC[3]));
        $saymsg .= chr(hexdec('ff')).chr(hexdec('01')).chr(hexdec(sprintf('%01b',0))).$msg;
        $client->send($saymsg);
        $needBuffer = chr(hexdec('ff')).chr(hexdec('02')).chr(hexdec("00"));
        $needBuffer = hash("crc32b", $needBuffer);
        $needBuffer = str_split($needBuffer, 2);
        $needBuffer = array_reverse($needBuffer);
        $statusmsg = "BE".chr(hexdec($needBuffer[0])).chr(hexdec($needBuffer[1])).chr(hexdec($needBuffer[2])).chr(hexdec($needBuffer[3]));
        $statusmsg .= chr(hexdec('ff')).chr(hexdec('01')).chr(hexdec("00"));
        $client->send($statusmsg);
    });

    $client->on('message', function($message) use ($client) {
        echo substr($message,9). PHP_EOL;

        global $msgseq;
        global $firsttime;

        if ($firsttime) {
            $statusmsg = "BE".chr(hexdec("7d")).chr(hexdec("8f")).chr(hexdec("ef")).chr(hexdec("73"));
            $statusmsg .= chr(hexdec('ff')).chr(hexdec('02')).chr(hexdec(sprintf('00')));
            $client->send($statusmsg);
            $firsttime = false;
        } else {
            $needBuffer = chr(hexdec('ff')).chr(hexdec('02')).chr(hexdec(sprintf('%2X', $msgseq)));
            $needBuffer = hash("crc32b", $needBuffer);
            $needBuffer = str_split($needBuffer, 2);
            $needBuffer = array_reverse($needBuffer);
            $statusmsg = "BE".chr(hexdec($needBuffer[0])).chr(hexdec($needBuffer[1])).chr(hexdec($needBuffer[2])).chr(hexdec($needBuffer[3]));
            $statusmsg .= chr(hexdec('ff')).chr(hexdec('02')).chr(hexdec(sprintf('%2X', $msgseq)));
            $client->send($statusmsg);
            $msgseq ++;
        }
    });

    $client->on('error', function() {
        echo 'Something went wront...' . PHP_EOL;
    });

    $loop->addPeriodicTimer(25, function () use($client) {
        global $msgseq;
        $msgseq --;
        echo '--Keep connection alive--' . PHP_EOL;
        $keepalive = "BE".chr(hexdec("be")).chr(hexdec("dc")).chr(hexdec("c2")).chr(hexdec("58"));
        $keepalive .= chr(hexdec('ff')).chr(hexdec('01')).chr(hexdec(sprintf('00')));
        $client->send($keepalive);
    });
 });

 $loop->run();
0FakE commented 6 years ago

@steffalon

For servers with lots of players you need multiple packets due to packet size limitations.

Like you can see in the protocoll it is "a step backwards in the sequence" like you said.

Btw. would you zip me the reactPHP library please? Seems like the master is corrupt or non-updating on Github.

0FakE commented 6 years ago

I'm already using the RCON class for a long time.

As you can (may) see in the screenshots I'm managing lots of servers with tons of people on it. Old control panel builds we're not live and the website took seconds to load.

Since weeks and months now I'm working on the PHP live version which isn't as easy as you know also because I'm not that professional coder...

The last screenshot is test build of the live version which is just a task connecting every 30s to the server and buffers the data in a database which will be shown up on the website.

To manage players with that method is fully okay.

But a static remote connection and reciving the status messages which includes the chat and so on would be better of cause and I would love it to find a solution. 👍

However you're interessted I would really like to step forward to make this possible just to run the code live and ofc to reconnect if the connection times out. However I can help you, let me know!

https://abload.de/img/4118or5b.png https://abload.de/img/4120zqdz.png https://abload.de/img/413fjqby.png

steffalon commented 6 years ago

@steffalon

For servers with lots of players you need multiple packets due to packet size limitations.

Like you can see in the protocoll it is "a step backwards in the sequence" like you said.

Btw. would you zip me the reactPHP library please? Seems like the master is corrupt or non-updating on Github.

@0FaKE are you using composer? If so, remove vendor and reinstall your libraries. All libraries are saved in your composer.json file.

This is my composer.json file content.

{
    "require": {
        "nizarii/arma-rcon-class": "^2.1",
        "cboden/ratchet": "^0.4.0",
        "react/stream": "^0.7.4",
        "clue/multicast-react": "~1.0",
        "react/datagram": "^1.3",
        "react/event-loop": "^0.4.3",
        "react/http": "^0.8.0",
        "react/promise-timer": "^1.2.1"
    }
}

I'm already using the RCON class for a long time.

As you can (may) see in the screenshots I'm managing lots of servers with tons of people on it. Old control panel builds we're not live and the website took seconds to load.

Since weeks and months now I'm working on the PHP live version which isn't as easy as you know also because I'm not that professional coder...

The last screenshot is test build of the live version which is just a task connecting every 30s to the server and buffers the data in a database which will be shown up on the website.

To manage players with that method is fully okay.

But a static remote connection and reciving the status messages which includes the chat and so on would be better of cause and I would love it to find a solution. 👍

However you're interessted I would really like to step forward to make this possible just to run the code live and ofc to reconnect if the connection times out. However I can help you, let me know!

https://abload.de/img/4118or5b.png https://abload.de/img/4120zqdz.png https://abload.de/img/413fjqby.png

I can try to make a reconnect function. But also I have to find out how to handle multiple packets.

nerdalertdk commented 6 years ago

An idea could be the make an wiki for each framework so one page for Native, Laravel, React and so on

felixms commented 6 years ago

An idea could be the make an wiki for each framework so one page for Native, Laravel, React and so on

Sounds great to me. I think the goal should be implementing the code by @steffalon into the class (cleaned up and issue by @0FaKE fixed), so that realizing this feature in any framework is as easy as possible. Afterwards we can add wiki articles for each framework.

felixms commented 6 years ago

🔒 Moved this thread to #31 in order to keep the issue tracker organized. Please go on in #31 😄