private IEnumerator Start() { UIMgr.OpenPanel <UIMsg>(); mHostIp = NetworkUtil.GetAddressIP(); mSocketServer = FlexiSocket.Create(1366, Protocols.BodyLengthPrefix, false); mSocketServer.ClientConnected += delegate(ISocketClientToken client) { Log.I("OnClientConnected ID:{0} Count:{1}", client.ID, mSocketServer.Clients.Count); }; mSocketServer.SentToClient += delegate(bool success, ISocketClientToken client) { if (success) { } }; mSocketServer.ReceivedFromClient += delegate(ISocketClientToken client, byte[] message) { SocketMsg msg = SerializeHelper.FromProtoBuff <SocketMsg>(message); mMessage = msg.msgId + ":" + msg.ToEventID; if (!string.IsNullOrEmpty(msg.Msg)) { mMessage += ":" + msg.Msg; } Log.I("OnReceivedFromClient:{0}", mMessage); mMsgQueue.Enqueue(msg); }; mSocketServer.ClientDisconnected += delegate(ISocketClientToken client) { }; mSocketServer.StartListen(10); yield return(0); }