2

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?

lolc
  • 115
  • 10
  • @Dai cause im trying to connect to a minecraft server via RCON. – lolc Feb 20 '21 at 04:49
  • Yeah sorry about that - I was researching what RCON was and because the top Google results all mentioned Valve and IOT I was thinking this was for SCADA/industrial-control (y'know... controlling industrial valves over the Internet - exactly the sort of thing that would have a small packet size limit). – Dai Feb 20 '21 at 04:49
  • @Dat yeah, minecraft uses valve's implementation of RCON. That means it runs over TCP and connects just like you'd do on a valve server – lolc Feb 20 '21 at 05:10
  • Please post a more complete program example - there's nothing _immediately visibly wrong_ with your program. Does your `onError` callback get called? Have you used a debugger? – Dai Feb 20 '21 at 05:20

1 Answers1

1

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.
Dai
  • 141,631
  • 28
  • 261
  • 374
  • That link you posted is from me. I tried using 3 other libraries but they all fail and trigger a onConnectionClose type of event. – lolc Feb 20 '21 at 21:23
  • @lolc Weeeelp... I think I should delete my answer then, but only if you add a link to that GitHub issue to your question so it won't get lost. – Dai Feb 23 '21 at 08:33