Sample code for 30+ languages & platforms
DataFlex

Determine if Connected and Logged On

See more FTP Examples

The IsConnected property indicates whether or not the FTP component has a valid TCP/IP connection (and is logged on) to the FTP server.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoFtp
    String sTemp1
    Boolean bTemp1

    Move False To iSuccess

    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Get Create (RefClass(cComChilkatFtp2)) To hoFtp
    If (Not(IsComObjectCreated(hoFtp))) Begin
        Send CreateComObject of hoFtp
    End

    Set ComHostname Of hoFtp To "ftp.example.com"
    Set ComUsername Of hoFtp To "mylogin"
    Set ComPassword Of hoFtp To "mypassword"

    // Connect and login to the FTP server.
    Get ComConnect Of hoFtp To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoFtp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // ...

    // At any point in an FTP session, the IsConnected property
    // can be checked to determine if the component has remained
    // connected to the FTP server.
    Get ComIsConnected Of hoFtp To bTemp1
    If (bTemp1 = True) Begin
        Showln "Connected!"
    End
    Else Begin
        Showln "Not connected!"
    End

    // ...

    Get ComDisconnect Of hoFtp To iSuccess


End_Procedure