title: how to stop trying to connect by namedpipe client to server if the server is not ready or unavailable
body: <p>I'm now implementing my academic project software using named pipe technologies to connect heterogeneous systems over the network. I used <strong>.net framework 4 and C# language.</strong> The problem is that the client program will not able to continue if the server is not ready or unavailable. The client named pipe continuously try to connect to the server named pipe until available connectivity. </p>
  
  <p>I want the client program to be able to continue other functions if the server connection is not available within 3 seconds (may be any duration). Like this scenario: When the client program is started, it will try to connect to server. If the server is not available, the client will stop trying to connect to server and run offline by itself. </p>
  
  <p>some code snippet of my problem...</p>
  
  <pre><code>pipeClient.Connect(); &lt;-- this is the problem point,
  frmUserprofile.show(); &lt;-- until the connection is available, the program will not execute this line
  </code></pre>
  
  <p>the solution that I would like to get...</p>
  
  <pre><code>pipeClient.Connect()
  if (3 seconds is over &amp;&amp; server connection is unavailable) &lt;-- this is what I need    
  {  pipeClient stops try to connect;  }
  
  frmUserprofile.show(); 
  </code></pre>
  
  <p>can someone help me to give some practical solution to me...
  by the ways, I hope if u can solve this problem with C# language, please give answers with C# but not necessarily
  thanks in advance...</p>