Scheduled task, FTP Timeout

Hi,

Our customer has some custom code to upload a csv file to a remote FTP server every X hours. They are now getting timeout errors when sending these csv files to the server. They are hosted in the SugarCloud

Has something changed in the latest version which might cause this issue and is there anything possible in configuration to increase the timeout for ftp requests?

From a code standpoint, I changed from ftp_put to ftp_nb_put, hoping this would solve the problem. But it does not solve it yet.

$this->connection = ftp_ssl_connect($this->credentials['hostname'], $this->credentials['port']);
$logged_in = ftp_login($this->connection, $this->credentials['username'], $this->credentials['password']);
ftp_pasv($this->connection, true);

$is_uploaded = ftp_nb_put($this->connection, $external_file, $local_file, FTP_BINARY, FTP_AUTORESUME);
while (FTP_MOREDATA == $is_uploaded){
$is_uploaded = ftp_nb_continue($this->connection);
}
if ($is_uploaded != FTP_FINISHED) {
$msg = sprintf('%s %s - Cannot upload file.', __CLASS__, __FUNCTION__);
$GLOBALS['log']->fatal($msg);
throw new \Exception($msg);
}

Regards,

Stijn

Parents Reply Children
No Data