Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: check for server timeout/offline in c#

$
0
0
If the server is off line the passwordAuthMethod times out. Is there a way to check the status of the connection? If it is offline I would skip my processing so the code doesn't error.
using (var passwordAuthMethod = new PasswordAuthenticationMethod(gstrTMS6Userid, gstrTMS6Password))
 {                        
          var connectInfo = new ConnectionInfo(gstrTMS6Server, gstrTMS6Userid, passwordAuthMethod, keyboardAuthMethod);                        

              using (SshClient sshConnection = new SshClient(connectInfo))
               {
                   sshConnection.Connect();    
                 }
}

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>