Esempio n. 1
0
        public A2S_INFO InfoPoll()
        {
            var client = GetConn();

            byte[] req      = new byte[] { 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 };
            var    response = ServerConnector.GetData(ref client, req);

            return(A2S_INFO.Read(response));
        }
Esempio n. 2
0
        public static void TestConn()
        {
            var client = ServerConnector.EstablishConnection("23.95.51.146", 29015);

            Console.WriteLine("Established connection");
            var response = ServerConnector.GetData(ref client, System.IO.File.ReadAllBytes(@"E:\send.bin"));

            Console.WriteLine("Got response of length " + response.Length);
            Console.WriteLine(Encoding.ASCII.GetString(response));

            Console.ReadLine();
        }
Esempio n. 3
0
        public A2S_PLAYER PlayerListPoll()
        {
            //First, request the challenge.
            var client = GetConn();

            byte[] req = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0xFF, 0xFF, 0xFF, 0xFF };
            //Request challenge
            byte[] chal = ServerConnector.GetData(ref client, req);
            //Swap challenge results and request again
            req[5] = chal[5];
            req[6] = chal[6];
            req[7] = chal[7];
            req[8] = chal[8];
            byte[] results = ServerConnector.GetData(ref client, req);
            //Results contains the list
            return(A2S_PLAYER.Read(results));
        }
Esempio n. 4
0
        private byte[] DoChallenge(byte reqType, byte endReqType, ref UdpClient client)
        {
            //First, request the challenge.
            byte[] req = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, reqType, 0xFF, 0xFF, 0xFF, 0xFF };
            //Request challenge
            byte[] chal = ServerConnector.GetData(ref client, req);
            //Swap challenge results and request again
            req[5] = chal[5];
            req[6] = chal[6];
            req[7] = chal[7];
            req[8] = chal[8];



            req[4] = endReqType;
            byte[] results = ServerConnector.GetData(ref client, req);
            return(results);
        }