Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(MFC) Check SSH Connection (IsConnected)Demonstrates how to check to see if the connection to the SSH server exists.
#include <CkSsh.h> void ChilkatSample(void) { CkString strOut; CkSsh ssh; // Connect to an SSH server: bool success = ssh.Connect("192.168.1.209",22); if (success != true) { strOut.append(ssh.lastErrorText()); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } // Is the last known state "connected"? bool connected = ssh.get_IsConnected(); if (connected == true) { // Verify for sure by sending an ignore message. connected = ssh.SendIgnore(); } strOut.append("connected = "); strOut.appendInt(connected); strOut.append("\r\n"); // Disconnect. ssh.Disconnect(); // Am I still connected? connected = ssh.get_IsConnected(); strOut.append("connected = "); strOut.appendInt(connected); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); } |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.