In my application, I want to have a polling loop which blocks on a socket receive operation but times out after 100 ms. This would allow me to exit the loop when I want (e.g. the user clicks something in the UI) while avoiding using a busy loop or Thread.sleep.
However, it seems that once a .NET socket is opened, it can only time out once. After the first timeout, any calls that would block throw an exception immediately.
According to this question, "you can’t timeout or cancel asynchronous Socket
operations." Why not? Is there a better way to approach the problem in the .NET world?