How do I close a NetworkStream that is being blocked by a Read operation?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi.

I am currently having an issue where I would like to exit a thread
that is being blocked by a Read operation on a NetworkStream. On a
separate thread I've tried calling Close on the NetworkStream and the
underlying TcpClient and they don't stop the Read operation. As far
as I've been able to tell, the Read will timeout @ 120 seconds after
the Close operations are called.

Along these same lines I've tried changing my Read to use BeginRead/
EndRead and it has a similar result.

Thanks for any suggestions.

.