void ReciveData(IPEndPoint ipend, byte[] MSSG) { if (MSSG.Length == 0) { return; } UDPDATA tmpdata = null; try { tmpdata = DataConver.BytesToUDPDATA(MSSG); } catch (Exception ee) { LogHelper.Log(ee.ToString()); } if (tmpdata != null) { if (tmpdata.udp_MesageID != 0) { NeedReply.RemoveAll(delegate(SendActor tm) { return(tm.udpd.udp_MesageID == tmpdata.udp_MesageID); }); mMessageID.RemoveID(tmpdata.udp_MesageID); } tmpdata.IPendpot = ipend; if (ShowReceiv) { LogHelper.Log("收到:", tmpdata); } if (HandleMessage != null) { HandleMessage(tmpdata); } } }
public bool RealMUSPSend(IPEndPoint mip, UDPDATA udpd) { if (mip == null) { return(false); } try { udpd.udp_Body.SendTime = DateTime.Now; byte[] mdata = DataConver.UDPDATAToBytes(udpd); mListenCLient.Send(mdata, mdata.Length, mip); if (ShowSend) { LogHelper.Log("发送", udpd); } return(true); } catch (Exception ee) { LogHelper.Log(ee.ToString()); return(false); } }