azure-relay-dotnet icon indicating copy to clipboard operation
azure-relay-dotnet copied to clipboard

Server sample stops sending of data

Open ddobric opened this issue 7 years ago • 3 comments

I have slightly changed the server sample application to continuously send the data to accepted connection.

                           while (true)
                            {
                                await writer.WriteLineAsync(DateTime.Now.ToLongTimeString());                               
                                Thread.Sleep(N);
                            }

After a while, server simply stops sending of data to that connection. I have also changed the version of server to prevent buffer overflow of the Console application, which might happen if too many data is written in the console output. When server stops writing, there is no any error indication.

While the same instance of the server (and client) is running (no more data exchange), I start next client. After a while server stops again sending of data to that client too.

ddobric avatar Jun 22 '17 13:06 ddobric

maybe this is because 'buffer' issue in writer, you can see https://github.com/Azure/azure-relay-dotnet/issues/57 , and try to write data directly by using Stream.

danny8002 avatar Jul 11 '17 10:07 danny8002

I agree the buffering could contribute. Add a call to Flush[Async] before the sleep/delay. However, I don't have full confidence that will make your issue work properly. What is the thread.sleep duration? (Also, use await Task.Delay(N) instead of Thread.Sleep to free up threadpool threads).

dlstucki avatar Oct 29 '19 17:10 dlstucki

@ddobric, are you still experiencing an issue? Please let us know how else we can help you.

jfggdl avatar Jan 27 '20 19:01 jfggdl