Sample code for 30+ languages & platforms
DataFlex

Use Explicit FTP over TLS

See more FTP Examples

Demonstrates how to connect to an FTP server using explicit FTP over TLS.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoFtp
    String sTemp1

    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.your-ftp-server.com"
    Set ComUsername Of hoFtp To "ftpAccountLogin"
    Set ComPassword Of hoFtp To "ftpAccountPassword"

    // Indicate that the "AUTH TLS" command should be use to convert the connection to TLS
    // after the initial TCP connection to port 21 is established.
    Set ComAuthTls Of hoFtp To True

    // Connect and convert the connection to TLS automatically.
    Get ComConnectOnly Of hoFtp To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoFtp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComLoginAfterConnectOnly Of hoFtp To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoFtp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Showln "TLS connection established and successfully authenticated."


End_Procedure