Based on the number of questions, forum posts, etc, it appears that the TcpClient/NetworkStream implementation in the BCL lacks decent support for cancelling IO operations. With the addition of Async methods in .NET 4.5, this lack of cancellation (or decent timeout support) makes things even more frustrating since it becomes even more complicated (nigh on impossible) to cancel a task that refuses to monitor its CancellationToken while performing IO.
I have seen many implementations that spin up additional threads to monitor the network operation and close the underlying stream if things seem to be going wrong. This feels very dirty in a world where we're trying to conserve these resources by using async operations.
Can anyone point me in the direction of guidance as to dealing with efficiently cancelling/timing out network IO operations or towards a robust 3rd party implementation that actually works?