 <p>There are two approaches:</p> <p>1. Encapsulated timeout</p> <p>The thread reading the data from network or serial port can measure time elapsed from its time of start and wait for the data for no more than the remaining time. Network communication APIs usually provide means to specify a timeout for the operation. Hence by doing simple DateTime arithmetic you can encapsulate timeout management within your worker thread.</p> <p>2. External timeout</p> <p>Use another thread (or do it in the main thread if that's feasible) to wait for the worker thread to finish within a certain time limit, and if not, abort it. Like this:</p> <pre><code>// start the worker thread ... // give it no more than 5 seconds to execute if (!workerThread.Join(new TimeSpan(0, 0, 5))) { workerThread.Abort(); } </code></pre>