FTP Client Questions and Support

Since there is no questions category at Fab, I created this thread to replace it. This is exclusively about this plugin: FTP Client | Fab

Hi, i’m trying to use your SimpleFTPClient in C++ (UE 4.27). I successfully connected in sync mode :

    FTPClient = USimpleFTPClientBPLibrary::connectToFTP_Server(
        SettingsManager->TabConfig.FtpIp,
        PortNumber,
        SettingsManager->TabConfig.FtpUsername,
        SettingsManager->TabConfig.FtpPassword,
        true, 
        true 
    );

But when i try in Async Mode, nothing happens :

UFTP_ConnectAsyncNode* ConnectionNode;
ConnectionNode = UFTP_ConnectAsyncNode::connectToFTP_ServerAsyncNode(
    SettingsManager->TabConfig.FtpIp,
    PortNumber,
    SettingsManager->TabConfig.FtpUsername,
    SettingsManager->TabConfig.FtpPassword,
    true, 
    true 
);
if (ConnectionNode)
{
    ConnectionNode->OnSuccess.AddDynamic(this, &USettingsWidget::OnFTPConnectSuccess);
    ConnectionNode->OnFail.AddDynamic(this, &USettingsWidget::OnFTPConnectFail);
}

Any idea ?

Regards, André

I recommend using the delegates in C++ instead of the async functions. Async functions are intended more for blueprints. Create a new function in your header file:

UFUNCTION()
void myFTPConnectFunction(bool success, int32 code, FString serverMessage)

Let VS create the function in the .cpp file.

void UMyClass::myFTPConnectFunction(bool success, int32 code, FString serverMessage)
{
}

This function is then triggered by the plugin when you connect or disconnect from the server. So that the plugin knows your function, you must pass it to the delegate. Somewhere in your code you have to do something like this:

USimpleFTPClientBPLibrary::getFTP_ClientTarget()->onFTPClientConnectionEventDelegate.AddDynamic(this, &UMyClass::myFTPConnectFunction);

Instead of “this”, you must pass the pointer to the class in which the function is. You can find the delegates in the SimpleFTPClientBPLibrary (h and cpp) file.

1 Like

Thank you it works now!