/// <summary> /// If send/receive fails this will retry to send and receive again. /// </summary> /// <exception cref="TimeoutException">If every retry fails</exception> /// <param name="msg">Message to send</param> /// <returns>Response</returns> public string RetrySendReceive(string msg) { lock (_LockObject) { int retries = this.Retries; do { try { _Instrument.Send(msg); return(_Instrument.Receive()); } catch { } } while (--retries > 0); } throw new TimeoutException(String.Format("Unable to send/receive {0}", msg)); }
public void Send(string msg) { Log("Send {0}", msg); try { _BaseInstrument.Send(msg); } catch (Exception e) { Log("Send threw {0}", e.Message); throw; } }