public void AddMessage(String Content, CY.UME.Core.Business.AsynResult asynResult, String accountId) { //当传入的内容为"-1"时,表示为建立连接请求,即为了维持一个从客户端到服务器的链接而建立的链接(那个等待的链接) //此时该链接保存到Ilist<AsynResult> Clients中,等待再有消息发送过来时,该Clients会被遍历,并且会在该消息输出后结束该链接 if (Content == "-1") { Clients.Add(asynResult); } else { //将当前请求的内容输出到客户端 asynResult.Content = Content; asynResult.AccountId = accountId; asynResult.Send(null); //遍历说有已缓存的Clients,并将当前内容输出到客户端 foreach (AsynResult result in Clients) { result.Content = Content; result.AccountId = accountId; result.Send(null); } //清空Ilist<AsynResult> Clients Clients.Clear(); } }