Quantcast
Channel: Chilkat Forum - latest questions
Viewing all articles
Browse latest Browse all 1061

Socket Reading Blocks Writing?

$
0
0

We already exchange from specific support for implementing your Socket library for a Listener under VB6.

Now, I have switched to VB.NET and play with asynchronous tasks and Handles. It works well but I do observed a strange behaviour with following scenario.

  1. Launch a Receive task to listen client: Dim receiveTask As Chilkat.Task = mySocket.ReceiveStringUntilByteAsync(Asc(vbCr))

  2. In mySocket_OnTaskCompleted, I do analyse message and re-run a new receivedTask to maintain litening

  3. When some events fired, I need to send message to client (not in response to client message but external trigger), then I launch a Send task to client: Dim sendTask As Chilkat.Task = mySocket.SendStringAsync(txtResponse & vbCr) I do use Task.userData to discriminate OnTaskCompleted handles actions between receiveTask and sendTask.

My problem is that I observed a throuput limitation in sendTask (external trigger may fire many time in 1s). When I defined the sendTask, it seems that it just wait for "mySocket.MaxReadIdleMs" before defining sendTask (probably like with the receiveTask running) and then I lost the asynchronous advantage. I exchange short message with client so I do place MaxReadIdleMs to 2000 but it create a candenced sendTask every 2s where I want it more reactive.

I do try to "Cancel" receiveTask before defining sendTask but I do observed same behaviour. Did I miss to something or is it normal ?


Viewing all articles
Browse latest Browse all 1061

Trending Articles