Closed Technoguyfication closed 3 years ago
It looks nice but I have a few questions to ask:
Why are you implementing a OnLog
delegate?
You can certainly make a separate HandleServerInput
just for RCON, so it can handle the RCON commands. From the looks of it, you might be returning the command output to the connected RCON client whenever a command is sent. And I may be wrong but I don't think you need to assure that RCON commands are executed in the order they were sent because they are sent via TCP, which means that packet order is meaningful and thus if each command is a different packet, you don't need to double check.
We don't use Little Endian in the client, thus the related methods could be moved to the server instead
Thanks for taking a look at my code, to address your concerns:
I implemented OnLog
inside DarkLog
because as far as I can see, there isn't another way to get the command output back. The commands write their output using DarkLog.WriteLog
, and from there it's outputted to a file and the console. Adding an event allows the program to see what's being written to the log, while preserving the original data. I can expand it with it's own EventArgs to be useful for other code in the future, instead of only outputting the formatted string.
HandleServerInput
isn't an issue, RCON is meant to process commands identically to how they would be processed from the server tty itself. When I say the commands need to be executed in order, I mean they need to be executed synchronously. The TCP listener for RCON runs on it's own worker thread, so I pause the thread until each packet is processed, so we don't start processing the commands on top of each other.
I'll move the extension methods to the server project, I wasn't sure whether they'd be useful for other things in the future.
I moved the extension methods to the server project and cleaned up the code. Did you have any other questions/concerns?
Hi! I just started using this server to play with my friends and I love this project! I thought it would be very useful to have a way to control my server remotely in case I'm not able to access the machine my server is running on. To solve this, I implemented SRCDS-styled RCON (Remote Console). It's the most widely used protocol for game servers and has many clients that support it. One popular client can be found here.
It integrates almost seamlessly with the existing command handlers and comes disabled by default. It starts a new TcpListener on a new port (6703 by default) and allows server admins to control the server from virtually anywhere. As the most popular multiplayer mod for KSP, I believe having a solid RCON implementation for the server is essential.
I hope you consider my addition, and I'd love to answer any questions you may have.