private void Execute() { if (m_Udp == null) { return; } tReqHead pHead = GetFirstReq(); if (pHead != null) { if (pHead.uReqType == eReqType.eREQ_TYPE_SEND) { RemoteFirstReq(); UdpReqSend sndReq = pHead as UdpReqSend; if (sndReq != null) { DoSend(sndReq); sndReq.Dispose(); } } } DoRead(); }
private void AddSendReq(byte[] pData, int bufSize, string ip, int port) { UdpReqSend pReq = new UdpReqSend(pData, bufSize, ip, port); lock (m_Mutex) { LinkedListNode <tReqHead> node = pReq.ListNode; m_QueueReq.AddLast(node); } }
protected virtual void DoSend(UdpReqSend req) { if (req == null || m_Udp == null || req.pSendData == null || req.pSendData.Length <= 0 || req.SendSize <= 0 || string.IsNullOrEmpty(req.ip) || req.port <= 0) { return; } try { m_Udp.Send(req.pSendData.GetBuffer(), req.SendSize, req.ip, req.port); } catch (Exception e) { #if DEBUG UnityEngine.Debug.LogError(e.ToString()); #endif } }