Sample code for 30+ languages & platforms
DataFlex

Check SSH Connection (IsConnected)

Demonstrates how to check to see if the connection to the SSH server exists.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoSsh
    Boolean iConnected
    String sTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatSsh)) To hoSsh
    If (Not(IsComObjectCreated(hoSsh))) Begin
        Send CreateComObject of hoSsh
    End

    // Connect to an SSH server:
    Get ComConnect Of hoSsh "192.168.1.209" 22 To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoSsh To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // Is the last known state "connected"?
    Get ComIsConnected Of hoSsh To iConnected
    If (iConnected = True) Begin
        // Verify for sure by sending an ignore message.
        Get ComSendIgnore Of hoSsh To iConnected
    End

    Showln "connected = " iConnected

    // Disconnect.
    Send ComDisconnect To hoSsh

    // Am I still connected?
    Get ComIsConnected Of hoSsh To iConnected
    Showln "connected = " iConnected


End_Procedure