Пример #1
0
        void ReadTcpInfo()
        {
            string path = Application.dataPath + "/TCPconfig/ip_port.txt";

            Debug.Log("path " + path);
            string tempString = File.ReadAllText(path);

            string[] configString = tempString.Split(';');
            ServerIp   = configString[0];
            ServerPort = int.Parse(configString[1]);

            _ipconfiged = true;

            Debug.Log("server ip: " + ServerIp + "    server port: " + ServerPort);

            SetupTCP();

            var initPocket = new InitPocket(_connection);

            initPocket.Read();
            var authGameGuard = new AuthGameGuard(_connection)
            {
                SessionId = initPocket.SessionId
            };

            authGameGuard.Run();
            authGameGuard.Read();
        }
Пример #2
0
        private void handlePacket(byte[] buff)
        {
            byte id = buff[0];

            ReceiveBasePacket msg = null;

            switch (id)
            {
            case 0x00:
                msg = new RequestAuthLogin(this, buff);
                break;

            case 0x02:
                msg = new RequestServerLogin(this, buff);
                break;

            case 0x05:
                msg = new RequestServerList(this, buff);
                break;

            case 0x07:
                msg = new AuthGameGuard(this, buff);
                break;

            default:
                CLogger.warning("LoginClient: received unk request " + id);
                break;
            }

            if (msg != null)
            {
                new Thread(new ThreadStart(msg.run)).Start();
            }
        }
Пример #3
0
        private void handlePacket(byte[] buff)
        {
            byte id = buff[0];

            //string str = "header: "+buff[0]+"\n";
            //foreach (byte b in buff)
            //    str += b.ToString("x2")+" ";

            //Console.WriteLine(str);
            //File.WriteAllText("header" + buff[0], str);

            ReceiveBasePacket msg = null;

            switch (id)
            {
            case 0x00:
                msg = new RequestAuthLogin(this, buff);
                break;

            case 0x02:
                msg = new RequestServerLogin(this, buff);
                break;

            case 0x05:
                msg = new RequestServerList(this, buff);
                break;

            case 0x07:
                msg = new AuthGameGuard(this, buff);
                break;

            default:
                CLogger.warning("LoginClient: received unk request " + id);
                break;
            }

            if (msg != null)
            {
                new Thread(new ThreadStart(msg.run)).Start();
            }
        }