I am writing a .NET Compact Framework application for a Windows CE device. My application communicates with a desktop computer using XML serialized data packets.
What I am encountering is that if the network cable becomes unplugged, my stream.Read operation blocks indefinitely. Setting a timeout is not supported in my CF.
I am looking for a "best practices" answer on how to deal with this issue. If the connection becomes closed for any reason, my loop should stop and begin trying to reconnect.
I have found this answer but it does not include the "using" directives that I need, and I am not sure what is going on anyway.
All tips are appreciated, especially if they solve the problem. Thanks!