PDA

View Full Version : How?... Java code to remote Rcon dedicated cod


Sagi
01-28-2004, 11:30 AM
Now I't feels like I'v been looking all over the net for information about how to connect to the server, and sendt it commands.

I'm trying via. UDP DatagramSocket and DatagramPacket to the port 28960. But the server dossent respond to "\\rconpassword" or other commands, so what am I doing wrong?

Can somone plz show me a place with info about this subjekt, or show me codefragments that works (In Java)

Thx ;)

NM156
01-28-2004, 05:26 PM
Try this: http://ftp.us.kde.org/idsoftware/quake3/docs/server.txt

Also: http://dev.kquery.com

jdwright
01-28-2004, 09:53 PM
One of my clanmates wrote a little snippet to show the getstatus in PHP. The way he sends the commands may be of interest to you.

http://www.clint.mwhq.net/stats.txt - Code

http://www.clint.mwhq.net/public.php - Example

Sagi
01-29-2004, 05:21 AM
Nice ;)
Thx for the links.

I't works now. The problem was in the string format.
I tryed sending data like this: "\\rconpassword <password>" (People that don't know why I set \\ in front. \\ is the same as \ i Java, cause only \ in Java has a funktion. ;)

But the server don't need \ before the command, and do not respond if you set a \ before the command.

The way you send the udp packet has to be by the protocol with the fist 4 bytes reserved to the packet numbering. like this..

byte[] = new String("xxxxrconpassword the_password_here").getBytes();
data[0] = (byte)0xff;
data[0] = (byte)0xff;
data[0] = (byte)0xff;
data[0] = (byte)0xff;
datagramPacket = new DatagramPacket(data, data.length, server.getServerIP(), server.getServerPort()); datagramSocket.send(datagramPacket);


Else you can use the link NM156 posted ;)
http://ftp.us.kde.org/idsoftware/quake3/docs/server.txt

Hope people can use this hint when they try to code their program to remote administrate the CoD server ;)