/// <summary> /// 发送数据 /// </summary> /// <param name="key"></param> /// <param name="data"></param> /// <returns></returns> protected byte[] SendData(string key, byte[] data) { byte[] re = null; if (!mComm.IsConnected) { return(null); } var tre = mComm.Take(); if (tre) { try { re = mComm.SendAndWait(key, data); } finally { mComm.Release(); } } return(re); }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="value"></param> /// <returns></returns> protected object SendObject(string key, object value) { object re = null; if (!mComm.IsConnected) { return(null); } var tre = mComm.Take(); if (tre) { try { re = mComm.SendObject(key, value); } finally { mComm.Release(); } } return(re); }