-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Dear Developer,
Thank you for this project.
Although, for example, we have a code where:
... // Somehere in AsyncTCPClient's initialization
ReceivedCallback = (c, count) =>
{
Console.WriteLine("2");
response = c.ByteBuffer.Dequeue(count);
if (responseLength + count <= int.MaxValue)
responseLength += count;
Console.WriteLine("3, responseLength = {0}", responseLength );
return Task.CompletedTask;
}
...
ct1 = new CancellationTokenSource(1000); // 1000ms for a request timeout
t1 = this.asyncTCPClient.Send(new ArraySegment<byte>(data, 0, data.Length), ct1.Token);
if (ct1.IsCancellationRequested) // If connection or any answer timeout
{
Console.WriteLine("Timeout");
}
else
{
ct1 = new CancellationTokenSource(1000); // 1000ms for a response timeour
Console.WriteLine("1");
t1 = this.asyncTCPClient.WaitAsync(ct1.Token); // Wait for any response available
Console.WriteLine("4, responseLength = {0}", responseLength);
}
And the output would be:
1
4, responseLength = 0 // It seems that WaitAsync does not wait while ByteBuffer dequeues.
2
3, responseLength = 41
Is it possible to force WaitAsync to wait while the full transaction would be completed?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels