CommunicatorWaitFor(ByteBuffer, WaitingTerminateProc, ByteBuffer, CancellationToken) Method

Sends specified data and waits for the response. The waiting loop will be terminated if waitingTerminateProc returns true. If ByteBuffer data is empty, nothing is sent. Incomming bytes are returned using parametr data (so data parameter cannot be null). The procedure clears ByteBuffer data before start of receiving. If multiple incomming streams should be received without sending output bytes, WaitForWithoutSend method should be used.

Definition

Namespace: OddPrg.Communication
Assembly: OddPrg.Communication (in OddPrg.Communication.dll) Version: 2.0.0.2 (2.0.0.2)
C#
public void WaitFor(
	ByteBuffer data,
	WaitingTerminateProc waitingTerminateProc,
	ByteBuffer displayData,
	CancellationToken cancelToken
)

Parameters

data  ByteBuffer
Buffer for outgoing/incomming data
waitingTerminateProc  WaitingTerminateProc
Callback which will decide if all expected data are received.
displayData  ByteBuffer
Data that could be displayed in a log. If this parameter is null, bytes from data parameter will be displayed. It can be useful e.g. when sending a password.
cancelToken  CancellationToken

See Also