Digital Paint Discussion Board
Development => General Development => Topic started by: f3l1x on August 27, 2010, 06:34:48 AM
-
Hello,
i wanna ask you about serverlist. Is there any system to check new servers? Or you must make it manual?
And, i have one idea how to make SB better. Can you share code? Or is there any complicates?
Thx a lot.
-
The serverlist has each server, where the serveradmin wrote this text into the config file: setmaster dplogin.com
Serverbrowser code: http://paintball2.cvs.sourceforge.net/viewvc/paintball2/serverbrowser/
-
Thx for code. And how do you create this list http://www.dplogin.com/serverlist.php? What a script?
-
Idk, jitspoe can answer that.
-
There's a master server daemon that runs on a UDP port (27000 or 27900 I think) on dplogin.com that receives "heartbeats" from each server. This daemon updates that list. serverbrowser.exe and the in-game browser re-download this list when you click update.
I'm not sure if the protocol specifications are published anywhere, but you should be able to figure it out from the engine source code or by using wireshark.
-
There is one specification, where you can't ping to dp server. There is no answer. I tested it in java, i opened socket but it was end like before. Datagram is only way how to get same response from srv.
-
I have i big problem with the COMMAND.
I test ping and status COMMAND in java..
here is a code:
public class UDPClient {
public static void main(String[] args) {
DatagramSocket udpSocket = null;
byte[] packetData = "\xFF\xFF\xFF\xFFstatus\n".getBytes();
System.out.println(packetData.length);
DatagramPacket packet = new DatagramPacket(packetData, packetData.length); //vytvořit paket
try {
udpSocket = new DatagramSocket(); //vytvořit soket
packet.setSocketAddress(new InetSocketAddress("83.169.4.183", 33333)); //nastavit paketu adresu
udpSocket.send(packet); //odeslat prázdný paket
System.out.println("Packet send: "+packet.getLength());
udpSocket.receive(packet); //počkat na přijetí paketu
System.out.println(new String(packetData, 0, packet.getLength())); //vytisknout obsah paketu
}
catch(IOException e) {
e.printStackTrace(System.err);
}
finally {
if(udpSocket != null) udpSocket.close();
}
}
There is a problem with escape "\xFF\xFF\xFF\xFFstatus\n" .. I really dont know how to write it.. I tried it with bytes array but server didn't respond.
Does anybody has a server specify or sth like that? Or sbt can tell me wheres the problem =/ ... thx
-
try changing
byte[] packetData = "\xFF\xFF\xFF\xFFstatus\n".getBytes();
to
byte[] packetData = "ÿÿÿÿstatus".getBytes();
-
byte[] packetData = "ÿÿÿÿstatus\n".getBytes();
Output:
15
Packet send 15
....
It w8ing for respond. I really dont know where is the problem... In the syntax?
-
Try getting rid of the newline "\n" in the packet. And test on multiple servers :)
-
Try getting rid of the newline "\n" in the packet. And test on multiple servers :)
It ended same like before. Did you try it? Do you know Java SDK?
-
I tried this too. Couldn't get it to work either.
I got it to work in perl my first try though...
-
Problem with firewall,antivir etc.. It shouldn't be, because normal "old" serverbrowser is working ..
-
You might want to try getBytes("US-ASCII"). I think the default encoding is UTF-8 and those 0xFFs may be getting encoded using UTF.
-
You might want to try getBytes("US-ASCII"). I think the default encoding is UTF-8 and those 0xFFs may be getting encoded using UTF.
Still same .. :(
-
I know nothing about Java, but this code seems to work for me. (I can see the response from server coming back in my sniffer)
import java.net.*;
import java.util.*;
import java.io.IOException;
public class UDPClient {
public static void main(String[] args) {
DatagramSocket udpSocket = null;
byte[] packetData = "ÿÿÿÿstatus\n".getBytes();
System.out.println(packetData.length);
DatagramPacket packet = new DatagramPacket(packetData, packetData.length); //vytvorit paket
try {
udpSocket = new DatagramSocket(); //vytvorit soket
packet.setSocketAddress(new InetSocketAddress("83.169.4.183", 33333)); //nastavit paketu adresu
udpSocket.send(packet); //odeslat prázdný paket
System.out.println("Packet send: "+packet.getLength());
udpSocket.receive(packet); //pockat na prijetí paketu
System.out.println(new String(packetData, 0, packet.getLength())); //vytisknout obsah paketu
} catch(IOException e) {
e.printStackTrace(System.err);
} finally {
if(udpSocket != null) udpSocket.close();
}
}
}
Results:
c:\Program Files\Java\jdk1.6.0_21\bin>javac c:\Users\XtremeBain\UDPClient.java
c:\Program Files\Java\jdk1.6.0_21\bin>cd c:\Users\XtremeBain\
c:\Users\XtremeBain>"c:\Program Files\java\jdk1.6.0_21\bin\java.exe" UDPClient
11
Packet send: 11
print
\
c:\Users\XtremeBain>
And my sniffer shows:
0000 ff ff ff ff 70 72 69 6e 74 0a 5c 54 69 6d 65 4c ....print.\TimeL
0010 65 66 74 5c 31 36 3a 33 34 5c 73 76 5f 63 65 72 eft\16:34\sv_cer
0020 74 69 66 69 63 61 74 65 64 5c 30 5c 6d 61 70 6e tificated\0\mapn
0030 61 6d 65 5c 61 69 72 74 69 6d 65 33 5c 5f 73 63 ame\airtime3\_sc
0040 6f 72 65 73 5c 52 65 64 3a 30 20 42 6c 75 65 3a ores\Red:0 Blue:
0050 30 20 5c 67 61 6d 65 6e 61 6d 65 5c 44 69 67 69 0 \gamename\Digi
0060 74 61 6c 20 50 61 69 6e 74 20 50 61 69 6e 74 62 tal Paint Paintb
0070 61 6c 6c 20 32 20 76 31 2e 39 31 39 28 31 37 30 all 2 v1.919(170
0080 29 5c 67 61 6d 65 76 65 72 73 69 6f 6e 5c 44 50 )\gameversion\DP
0090 50 42 32 20 76 31 2e 39 31 39 28 31 37 30 29 5c PB2 v1.919(170)\
00a0 6e 65 65 64 70 61 73 73 5c 31 5c 67 61 6d 65 64 needpass\1\gamed
00b0 61 74 65 5c 4d 61 79 20 31 33 20 32 30 31 30 5c ate\May 13 2010\
00c0 73 76 5f 6c 6f 67 69 6e 5c 32 5c 65 6c 69 6d 5c sv_login\2\elim\
00d0 31 35 5c 6c 6f 63 61 74 69 6f 6e 5c 43 6f 6c 6f 15\location\Colo
00e0 67 6e 65 2c 20 47 65 72 6d 61 6e 79 5c 65 2d 6d gne, Germany\e-m
00f0 61 69 6c 5c 69 6e 66 6f 40 4f 54 42 2d 43 6c 61 ail\info@OTB-Cla
0100 6e 2e 64 65 5c 61 64 6d 69 6e 5c 54 33 52 52 30 n.de\admin\T3RR0
0110 52 31 35 54 2c 20 43 68 65 66 2d 4b 69 6c 6c 65 R15T, Chef-Kille
0120 72 2c 20 70 72 69 6e 63 65 5c 77 65 62 73 69 74 r, prince\websit
0130 65 5c 68 74 74 70 3a 2f 2f 77 77 77 2e 4f 54 42 e\http://www.OTB
0140 2d 43 6c 61 6e 2e 64 65 5c 68 6f 73 74 6e 61 6d -Clan.de\hostnam
0150 65 5c 5b 4f 54 42 5d 20 4d 61 74 63 68 20 31 20 e\[OTB] Match 1
0160 2d 20 77 77 77 2e 4f 54 42 2d 43 6c 61 6e 2e 64 - www.OTB-Clan.d
0170 65 5c 6d 61 78 63 6c 69 65 6e 74 73 5c 31 36 5c e\maxclients\16\
0180 70 72 6f 74 6f 63 6f 6c 5c 33 34 5c 74 69 6d 65 protocol\34\time
0190 6c 69 6d 69 74 5c 32 30 5c 66 72 61 67 6c 69 6d limit\20\fraglim
01a0 69 74 5c 35 30 5c 76 65 72 73 69 6f 6e 5c 32 2e it\50\version\2.
01b0 30 30 20 69 33 38 36 20 4d 61 79 20 31 33 20 32 00 i386 May 13 2
01c0 30 31 30 20 4c 69 6e 75 78 20 28 33 30 29 5c 67 010 Linux (30)\g
01d0 61 6d 65 64 69 72 5c 70 62 61 6c 6c 5c 67 61 6d amedir\pball\gam
01e0 65 5c 70 62 61 6c 6c 0a e\pball.
-
And my sniffer shows:
0000 ff ff ff ff 70 72 69 6e 74 0a 5c 54 69 6d 65 4c ....print.\TimeL
0010 65 66 74 5c 31 36 3a 33 34 5c 73 76 5f 63 65 72 eft\16:34\sv_cer
0020 74 69 66 69 63 61 74 65 64 5c 30 5c 6d 61 70 6e tificated\0\mapn
0030 61 6d 65 5c 61 69 72 74 69 6d 65 33 5c 5f 73 63 ame\airtime3\_sc
0040 6f 72 65 73 5c 52 65 64 3a 30 20 42 6c 75 65 3a ores\Red:0 Blue:
0050 30 20 5c 67 61 6d 65 6e 61 6d 65 5c 44 69 67 69 0 \gamename\Digi
0060 74 61 6c 20 50 61 69 6e 74 20 50 61 69 6e 74 62 tal Paint Paintb
0070 61 6c 6c 20 32 20 76 31 2e 39 31 39 28 31 37 30 all 2 v1.919(170
0080 29 5c 67 61 6d 65 76 65 72 73 69 6f 6e 5c 44 50 )\gameversion\DP
0090 50 42 32 20 76 31 2e 39 31 39 28 31 37 30 29 5c PB2 v1.919(170)\
00a0 6e 65 65 64 70 61 73 73 5c 31 5c 67 61 6d 65 64 needpass\1\gamed
00b0 61 74 65 5c 4d 61 79 20 31 33 20 32 30 31 30 5c ate\May 13 2010\
00c0 73 76 5f 6c 6f 67 69 6e 5c 32 5c 65 6c 69 6d 5c sv_login\2\elim\
00d0 31 35 5c 6c 6f 63 61 74 69 6f 6e 5c 43 6f 6c 6f 15\location\Colo
00e0 67 6e 65 2c 20 47 65 72 6d 61 6e 79 5c 65 2d 6d gne, Germany\e-m
00f0 61 69 6c 5c 69 6e 66 6f 40 4f 54 42 2d 43 6c 61 ail\info@OTB-Cla
0100 6e 2e 64 65 5c 61 64 6d 69 6e 5c 54 33 52 52 30 n.de\admin\T3RR0
0110 52 31 35 54 2c 20 43 68 65 66 2d 4b 69 6c 6c 65 R15T, Chef-Kille
0120 72 2c 20 70 72 69 6e 63 65 5c 77 65 62 73 69 74 r, prince\websit
0130 65 5c 68 74 74 70 3a 2f 2f 77 77 77 2e 4f 54 42 e\http://www.OTB
0140 2d 43 6c 61 6e 2e 64 65 5c 68 6f 73 74 6e 61 6d -Clan.de\hostnam
0150 65 5c 5b 4f 54 42 5d 20 4d 61 74 63 68 20 31 20 e\[OTB] Match 1
0160 2d 20 77 77 77 2e 4f 54 42 2d 43 6c 61 6e 2e 64 - www.OTB-Clan.d
0170 65 5c 6d 61 78 63 6c 69 65 6e 74 73 5c 31 36 5c e\maxclients\16\
0180 70 72 6f 74 6f 63 6f 6c 5c 33 34 5c 74 69 6d 65 protocol\34\time
0190 6c 69 6d 69 74 5c 32 30 5c 66 72 61 67 6c 69 6d limit\20\fraglim
01a0 69 74 5c 35 30 5c 76 65 72 73 69 6f 6e 5c 32 2e it\50\version\2.
01b0 30 30 20 69 33 38 36 20 4d 61 79 20 31 33 20 32 00 i386 May 13 2
01c0 30 31 30 20 4c 69 6e 75 78 20 28 33 30 29 5c 67 010 Linux (30)\g
01d0 61 6d 65 64 69 72 5c 70 62 61 6c 6c 5c 67 61 6d amedir\pball\gam
01e0 65 5c 70 62 61 6c 6c 0a e\pball.
Where did you find it? What kind of "sniffer" do you use? So, the problem is in receiving the responce... =/
What is wrong?
--
udpSocket.receive(packet);
--
mmmm.. On which port did you receive it? On which port returned server "status"? I have to check if is it allowed...
-
Yeahoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...
It's at home!!!
byte [] b = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, new Byte("115"),
new Byte("116"),new Byte("97"),new Byte("116"),new Byte("117"),new Byte("115")};
byte[] packetData = b;
-
I couldn't get it to work with \xFF in the string. My text editor is decent and lets me save ÿ characters fine. javac has no problems compiling those characters (at least in my locale).
Wireshark is the sniffer. The Java library uses a random source port for the first datagram packet, the server replies to that port (was something like 52314 in my case) from its listening port. It raised a firewall prompt on my Windows box, I had to allow java.exe access the first time.
You might want to put { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF } in its own variable. Then you can prepend it to other commands (i.e. players, rcon) and your code can be a little more readable.