void StartWaitSendThread(TcpSocketClient client) { //开启线程读取上次未发送的消息 ThreadPool.QueueUserWorkItem((obj) => { var userNumber = mtClientPool.First(i => i.Socket == client).UserNumber; var dao = StorageProvider <SubmitStorage> .GetStorage(); var list = dao.GetList(userNumber); if (list.Count() > 0) { foreach (var submit in list) { var d = new Deliver { SPNumber = submit.SPNumber, UserNumber = submit.UserNumber, TP_pid = 0, TP_udhi = 0, MessageCoding = MessageCodes.GBK, MessageContent = submit.Content }; client.Send(d.GetBytes()); //映射序列号 MapSequeue(d.SequenceNumberString, submit.SequenceNumber); } } }); }
void StartWaitSendThread(TcpSocketClient client) { //开启线程读取上次未发送的消息 ThreadPool.QueueUserWorkItem((obj) => { var spNumber = spClientPool.First(i => i.Socket == client).SPNumber; //读取为发送的消息 var deliverDao = StorageProvider <DeliverStorage> .GetStorage(); var deliverList = deliverDao.GetList(spNumber); if (deliverList.Count() > 0) { foreach (var deliver in deliverList) { var d = new Deliver { SPNumber = deliver.SPNumber, UserNumber = deliver.UserNumber, TP_pid = 0, TP_udhi = 0, MessageCoding = MessageCodes.GBK, MessageContent = deliver.Content }; client.Send(d.GetBytes()); //映射序列号 MapSequeue(d.SequenceNumberString, deliver.SequenceNumber); } } //读取上次未发送的报告 var reportDao = StorageProvider <ReportStorage> .GetStorage(); var reportList = reportDao.GetList(spNumber); if (reportList.Count() > 0) { foreach (var report in reportList) { var r = new Report { SubmitSequenceNumber = report.TargetSubmitSequenceNumber, ReportType = (uint)report.ReportType, State = (uint)report.State, ErrorCode = (uint)report.ErrorCode, UserNumber = report.UserNumber }; client.Send(r.GetBytes()); //映射序列号 MapSequeue(r.SequenceNumberString, report.SubmitSequenceNumber); } } }); }