private void TcpServer_ClientReceiveData(AsyncUserToken userToken, byte[] data) { if (!shareDesktop) { return; } bool isExist = false; lock (rdViewers) { if (rdViewers.ContainsKey(userToken.Identifier)) { isExist = true; } } if (!isExist) { ResMsg rm = Authentication(data); if (rm.Result) { ThreadPool.UnsafeQueueUserWorkItem(new WaitCallback(state => { AsyncUserToken asyncUserToken = (AsyncUserToken)state; asyncUserToken.SendData(Encoding.ASCII.GetBytes("login ok!")); }), userToken); RDViewer viewer = new RDViewer() { UserName = rm.Message, UserToken = userToken }; lock (rdViewers) { rdViewers.Add(userToken.Identifier, viewer); } ShowLog(viewer.UserName + "开始观看,来源:" + userToken.Identifier); } } else { lock (recvBuffer) { recvBuffer.AddRange(data); } } }