/// <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 string Receive() { Log("Receive"); try { string receive = _BaseInstrument.Receive(); Log("Receive ret: {0}", receive); return(receive); } catch (Exception e) { Log("Receive threw {0}", e.Message); throw; } }