public async void Init() { client = new EasyClient(); client.Initialize(new MyTerminatorReceiveFilter(), (request) => { // handle the received request syncManager.Add(() => { callBack(request.Key, request.Body, request.Parameters); }); // Debug.Log(request.Body); //NGUIDebug.Log(request.Body); }); client.Error += (s, e) => { // NGUIDebug.Log(e.Exception.Message); isLogin = false; }; client.Closed += (s, e) => { isLogin = false; }; // client.NewPackageReceived += Client_NewPackageReceived; string IP = Config.parse("ServerIP"); var connected = await client.ConnectAsync(new IPEndPoint(IPAddress.Parse(IP), port)); if (connected) { // NGUIDebug.Log("connet success"); Debug.Log("connet success"); isLogin = true; // Send data to the server //client.Send(Encoding.ASCII.GetBytes("ADD*1#2 \r\n")); // Send("ADD*1#2"); } }