/// <summary> /// 向客户端发送数据 /// </summary> /// <param name="buff"></param> /// <param name="isSendNow">是否立即发送</param> public void SendPackage(DogBuffer buff, bool isSendNow = true) { if (Socket == null || !Socket.Connected) { return; } buff.Use(); lock (m_PendingBuffer) { m_PendingBuffer.Enqueue(buff); } if (isSendNow) { PeekSend(); } }
/// <summary> /// 向客户端发送数据 /// </summary> /// <param name="buff"></param> /// <param name="isSendNow">是否立即发送</param> public void SendPackage(DogBuffer buff, bool isSendNow = true) { if (Socket == null || !Socket.Connected) { return; } if (buff.Length == 0) { throw new Exception("buff lenght is zero."); } buff.Use(); lock (m_PendingBuffer) { m_PendingBuffer.Enqueue(buff); } if (isSendNow) { PeekSend(); } }