Calculate packet size for RCON?

Viewed 140

Hullo!

Using mbr-rcon, im able to send commands and get the output using the following code (I ommited the create connection part for simplicity):

command = "list";

rconclient.send(command, {
    onSuccess: function(response){},
            
    onError: function(error){
        console.log(error);
    }
});

Theres one problem tho, if i try and send a really long command (1400ish characters) it fails. So I tought that maybe it'd be a good idea to come up with a function to limit the character size, right? But here's the catch: The RCON spec says the max packet size is 4096 bytes. Even if I limit the output to 4096B, it still fails at like 1400ish. Why is that? Even if my input is 100% ASCII text it fails and makes the library's onClose(); method fire up (which is used for when the connection terminates). Many libraries I've tried have a similar problem.

Any tips frens?

1 Answers

I think you're encountering an issue other users have reported: https://github.com/MadBrozzeR/rcon/issues/3

You have a few options:

  1. Deep-dive into the code and fix whatever the underlying issue is yourself. I'm willing to bet that mbr-rcon is not flushing its buffers correctly.
  2. Use a different library
  3. Find the library's maintainer and convince them to fix it for you.
Related