( search forums )
Soldat Admin Protocol
Soldat Forums - Soldat Talk - Developers Corner
April 16, 2004, 6:21 am
Hey guys,

Just starting a thread on the soldat admin protocol, and what we all know about it so far. Contributions from anyone who knows something please :)

Here's what I know...

Basically, you connect to the server on the port specified in soldat.ini, I'm not sure which one it is, Port or JoinPort :). Someone can investigate this.. I really don't care :P.

After connecting, you send you're login packet, which is the password terminated by carriage return and newline. In php, c++ etc you can use escape chars \r\n. Any packets I detail in here will use these chars.

This is where it gets a bit yucky.. Regardless of password validity, the server bounces back a packet saying "Soldat Admin Connection Established...\r\n". Then it will send login reply... UGLY! It doesn't give you a nice little single byte, instead it sends a packet comprising of "Soldat Admin Connected.\r\n<LoginSuccess>", where <LoginSuccess> is either "Invalid server password. Cannot login.\r\n" for invalid password, or "Successfully logged in.\r\nWelcome you are command of serv......" and some helpful info about how commands are detailed in the soldat manual. When checking if password was correct, I just check to see if Succes is inside the return packet.

If password was invalid, you are disconnected immediately. I suppose this would be a better way of checing pass validity, once sending packet, if you aren't disconnected then you're in the clear :).

Once logged in, you're set. Any console output will be sent to you, so you'll get those time left messages, player connection, lobby connection messages etc etc. Now you can send the typical server command packets, such as /say, /map, /kick, /kicklast etc. Once oyu send these packets, they get sent back to you, this is because you are sent all console output remember :). Kinda weird, but anyway, you could think of these replies as the TID's in the msn messenger protocol (if you've ever fiddled with it. If ya haven't give it a go, lots of fun :P), if you get the same command sent back to you, it was successful.

There is also the REFRESH command I talked about in my other post in this same forum (Developers Corner), which I am yet to figure out. I know that from this data stuff like current map, time left and game type are figured out, but I'm not too sure on the structure yet :). If Michal coded the server in c++, then I'll bet he just sent a struct through :).

Now we reach the end of my knoweledge, the server shutdown, this might have changed in 2.09b, but last time I checked, it was just "SHUTDOWN\r\n", you'll get a reply called "Shutting server...\r\n" and the connection, and the server, will be closed. With 2.09b there is a new command called /shutdown anyways isn't there? So I spose you can just use that.