Answer the question
In order to leave comments, you need to log in
C# Watchdog for thread?
A MITM proxy server is being written using NetworkStream and SslStream.
The problem is that NetworkStream doesn't signal connection close (callback or exception).
For example, a request "proxy server" has been processed and is waiting for the Web server to respond ( NetworkStream.Read ), or it's set to Connection: keep-alive and you need to keep the connection, or the situation when the channel is slow and receiving data takes a long time, in general, it doesn't matter if it takes a long time work as a Web server via NetworkStream/SslStream. And the client NetworkStream closed (timeout or browser tab closed).
I see an option, when processing a new client NetworkStream, to start monitoring it in a separate thread for an exception with a zero write to the stream (as recommended by MSDN).
From here the question is how to complete the parent thread from the child thread.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question