static void test1()
        {
            Console.Write("PORT:");
            int port = int.Parse(Console.ReadLine());

            Console.WriteLine(ClientC.Access("127.0.0.1", 9840, port).Info);
            ClientC.Receive(ar => { Console.WriteLine(ar); });
            while (true)
            {
                string cmd = Console.ReadLine();
                if (cmd == "shutdown")
                {
                    break;
                }
                else if (cmd == "login")
                {
                    ClientC.Send(MessageTranslate.EncapsulationInfo(MessageContent.登录, MessageType.请求, "1501", "123"));
                }
                else if (cmd == "login1")
                {
                    ClientC.Send(MessageTranslate.EncapsulationInfo(MessageContent.登录, MessageType.请求, "0000", "123456"));
                }
                else
                {
                    ClientC.Send(cmd);
                }
            }
        }
示例#2
0
 public void Init(string serverIP, int serverPort, int localPort)
 {
     clientSocket.Access(serverIP, serverPort, localPort, Accept);
 }