title: Best way to cancel a unix call (using SSH library) via the UI in a synchronous application in C#?
body: <p>My program (.NET 4.0) uses a 3rd party SSH library (<a href="http://sshnet.codeplex.com/" rel="nofollow">SSH.NET</a>, works great so far) to send a unix command that is constructed based on the user's choices in the UI, waits for the respose and outputs it.  My problem arises when sometimes the unix response just "hangs" for lack of a better term, in which cases my program is stuck waiting.  In unix you can just escape that command (for me CTRL-C) and try again, but when using a library, I'm not sure how to provide the equivelent.</p>
  
  <p>Another problem is that the UI thread is locked when this is happening, so even if there was some sort of "Cancel" button the user wouldn't be able to click on it.  I looked into BackgroundWorker and Threading, but that doesn't really make sense because my operation is synchronous - the program has to wait for the response so it can parse it (format, color, ect).</p>
  
  <p>Any thoughts on this would much appriciated, thanks all!</p>