Discuss this help topic in MsgConnect Forum

PostMessage/SendMessage* operations can fail due to a number of reasons, such as invalid address, impossibility to connect to destination or some other reason. The error can happen before the message is passed to transport for delivery or after that.
When the message delivery fails before the message is passed to transport, an exception is raised. When the message delivery fails after that, before MsgConnect 1.3 there was no way to get to know about error or timeout.
In MsgConnect the application is notified about error in two ways:

  1. Using exception, when you use any of PostMessage/SendMessage* methods. Note, that if error happens after the call to SendMessageCallback or SendMessageTimeoutCallback, exception is not raised (of course).
  2. Using callback when you use SendMessageTimeoutCallback method.

The application is notified about timeout in several ways:
  1. Using exception in SendMessage method
  2. By returning false in SendMessageTimeout method
  3. Using OnTimeout callback when you use SendMessageTimeoutCallback method
In other words, to properly handle all error and timeout situations, it is necessary to use either SendMessageTimeout or SendMessageTimeoutCallback methods.

 

Discuss this help topic in MsgConnect Forum