private void descMsg(byte[] bMsg, EditorClient client) { NetCommand cmd = NetService.DescCommand(ref bMsg); if (cmd == null) { return; } NetCmd nCmd = new NetCmd(); nCmd.client = client; nCmd.cmd = cmd; if (currentReadList == 1) { cmdList2.Add(nCmd); } else { cmdList1.Add(nCmd); } //client.HandleMsg(); if (bMsg != null && bMsg[0] != 0) { descMsg(bMsg, client); } }
public void BuildingSocketInvokeElement(ref AsyncSocketUserToken userToken) { TCPProtocol tcpHandle = new TCPProtocol(AsyncSocketSvr, userToken); userToken.AsyncSocketInvokeElement = tcpHandle; tcpHandle.MessageReceiveEvent = new SocketTCPEventHandler( (object sender, byte[] bMessage) => { // TODO 消息解析 TCPProtocol proto = (TCPProtocol)sender; EditorClient client = null; if (proto.MessageHandle == null) { client = new EditorClient(); proto.MessageHandle = client; client.TCPHandle = proto; client.FrameSpeedChange = new FPSChange((int fps) => { if (FrameSpeedChange != null) { FrameSpeedChange(fps); } }); client.LogOutputEvent = new LogOutput((string log) => { if (LogOutputEvent != null) { LogOutputEvent(log); } }); Clients.Add(client); } else { lock (lock_obj) { client = proto.MessageHandle as EditorClient; descMsg(bMessage, client); } } }); if (userToken.AsyncSocketInvokeElement != null) { Debug.WriteLog.Log(eLogLevel.ell_Debug, "[ true ]" + "Building socket invoke element " + userToken.AsyncSocketInvokeElement + ".Local Address: " + userToken.ConnectSocket.LocalEndPoint + ", Remote Address: " + userToken.ConnectSocket.RemoteEndPoint); } }