/// <summary> /// 异步发送数据 /// </summary> /// <param name="key"></param> /// <param name="data"></param> /// <returns></returns> protected bool SendDataAsync(string key, byte[] data) { if (!mComm.IsConnected) { return(false); } var tre = mComm.Take(); if (tre) { try { mComm.SendAsync(key, data); } finally { mComm.Release(); } } return(tre); }
/// <summary> /// 异步发送数据 /// </summary> /// <param name="key"></param> /// <param name="data"></param> /// <returns></returns> protected bool SendDataAsync(Span <byte> data) { if (!mComm.IsConnected) { return(false); } var tre = mComm.Take(); if (tre) { try { mComm.SendAsync(data); } finally { mComm.Release(); } } return(tre); }