Click or drag to resize

IncomingMessageManagerTTransactionAsync Method

Sends a (pre-prepared) request and (optionally) waits for a response (synchronously or asynchronously).

Namespace:  Demo3D.Net
Assembly:  Demo3D.IO (in Demo3D.IO.dll) Version: 10.0.0.0 (10.0.0.0)
Syntax
C#
public Task TransactionAsync(
	SendMessageDelegateAsync sendMessageAsync,
	IncomingMessageManagerTMessageHandler response,
	bool waitForResponse,
	int waitTimeoutMs,
	CallbackContext callbackContext = CallbackContext.CallerContext
)

Parameters

sendMessageAsync
Type: Demo3D.NetSendMessageDelegateAsync
A method for sending the initial request message.
response
Type: Demo3D.NetIncomingMessageManagerTMessageHandler
A handler for receiving the response (or null).
waitForResponse
Type: SystemBoolean
True to wait for and handle the response before returning. Otherwise the response is handled asynchronously in a separate thread.
waitTimeoutMs
Type: SystemInt32
How long to wait for the response (in milliseconds).
callbackContext (Optional)
Type: Demo3D.NetCallbackContext
Defines the context in which the message handler should be called.

Return Value

Type: Task
Nothing.
Remarks

Exceptions:

This method may throw exceptions under different circumstances, depending on the configuration and the parameters passed to this call and to previous calls. If a handler throws an exception then the exception may be reported here. But if (for example) waitForResponse is false then the exception may be reported in the next call to this method, even though it does not relate to that transaction.

Best practice is for a handler not to throw exceptions, but rather to catch and handle the exceptions itself.

Timeouts:

It may still be necessary to pass a non-zero timeout in waitTimeoutMs even if waitForResponse is false. Although waitForResponse false implies that this method should not wait, and therefore a timeout is not required, there are circumstances when it will wait.

Depending on the configuration this method may be subject to flow control. For example if the configuration is RespondBehind, then we can't send this request until we've received the reply to the previous request, and this call will need to wait for that reply before it can send.

See Also