コード例 #1
0
ファイル: GpcmClient.cs プロジェクト: ttitt/LoginEmulator
        private void HandleClient()
        {
            // If there is data in the stream, clear it out!
            if (Stream.HasData())
            {
                Stream.Read();
            }

            // Get our client endpoint and Log thier connection
            EndPoint ClientEP = Client.Client.RemoteEndPoint;

            Server.Log("[GPCM] Client Connected: {0}", ClientEP);

            // Start by sending the server challenge
            SendServerChallenge();

            // While client remains connected, continuelly check for updates
            while (Client.Client.IsConnected())
            {
                Update();
                Thread.Sleep(200);
            }

            Server.Log("[GPCM] Client Disconnected: {0}", ClientEP);
            Dispose();
        }
コード例 #2
0
        /// <summary>
        /// Main Listener loop
        /// </summary>
        public void Update()
        {
            if (Stream.HasData())
            {
                // TODO: process the 'getprofile' (returned at this point) data
                string   message = Stream.Read();
                string[] recv    = message.Split('\\');
                try
                {
                    switch (recv[1])
                    {
                    case "nicks":
                        SendGPSP(recv);
                        break;

                    case "check":
                        SendCheck(recv);
                        break;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Main Listener loop
        /// </summary>
        public void Update()
        {
            if (Stream.HasData())
            {
                // TODO: process the 'getprofile' (returned at this point) data
                string   message = Stream.Read();
                string[] recv    = message.Split('\\');

                switch (recv[1])
                {
                case "nicks":
                    SendGPSP(recv);
                    break;

                case "check":
                    SendCheck(recv);
                    break;
                }
            }
        }