伙计们我正在尝试编写一个简单的
java程序来查询反恐精英1.6服务器:
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
public class Test {
private static DatagramSocket ds;
/**
* @param args
*/
public static void main(String[] args) {
try {
ds = new DatagramSocket(27024);
byte[] data;
// TSource Engine Query
char peer0_0[] = {
0xff, 0xff, 0xff, 0xff,
0x54, 0x53, 0x6f, 0x75,
0x72, 0x63, 0x65, 0x20,
0x45, 0x6e, 0x67, 0x69,
0x6e, 0x65, 0x20, 0x51,
0x75, 0x65, 0x72, 0x79, 0x00
};
data = new String(peer0_0).getBytes();
System.out.println("send:" + new String(data));
DatagramPacket dp = new DatagramPacket(data, 0, data.