title: How to detect connectivity to my server using Silverlight 4
body: <p>The users of my Silverlight application will access the server via a VPN connection.  Thus, the built in NetworkInterface.GetIsNetworkAvailable is of no use.</p>
  
  <p>I tried 2 different methods for checking connection to my server; WebClient and a WCF service.</p>
  
  <p>As for the service, I tried the following method.  I can't see how I would use a regular service call since the return handler would never hit.</p>
  
  <pre><code>var ping = new PingServiceClient();  
  ping.InnerChannel.Open( new TimeSpan(1500) );  
  var result = ping.State == CommunicationState.Opened;
  </code></pre>
  
  <p>Using WebClient, I tried this:</p>
  
  <pre><code>var client = new WebClient();  
  client.OpenReadCompleted += (s, e) =&gt; { MessageBox.Show( "Returned from server" ); };  
  client.OpenReadAsync( new PingServiceClient().Endpoint.Address.Uri );
  </code></pre>
  
  <p>In both cases, the results were the same (indicates connected) whether or not I was connected to the server (I pushed the samples to the live server and connected/disconnected using the VPN client.</p>
  
  <p>The next thing I would try is sockets, but just getting a working sample is beyond difficult.  Before going down that road any further, is there some other way of accomplishing this?</p>