EG915N FTP Download a File Problem

Hi, I want to download a file from FTP server. My FTP user has all permissions. I have no problem downloading the file with Filezilla. But I have a problem with FTP operations on my system where I use EG915N. I connect to FTP and view the files. However, when I want to download the file, the file content is downloaded as 0 bytes. I am sharing the codes and serial port below. I would appreciate your help.


AT+QFTPCWD=“/”

OK

+QFTPCWD: 0,0
Jump to CHECKPATH.

AT+QFTPPWD

OK

+QFTPPWD: 0,“/”
Jump to GETFILE.

AT+QFTPGET=“Test4G.txt”,“COM:”

CONNECT

OK

+QFTPGET: 0,0


switch(ftpStatus){
case BEGIN:
modemWrite(“AT+QIACT?\r\n”);
break;
case CONFIGURE:
modemWrite(“AT+QFTPCFG="contextid",1\r\n”);
break;
case TIMEOUT:
modemWrite(“AT+QFTPCFG="rsptimeout",90\r\n”);
break;
case TRANSMODE:
modemWrite(“AT+QFTPCFG="transmode",1\r\n”);
break;
case FILETYPE:
modemWrite(“AT+QFTPCFG="filetype",1\r\n”);
break;
case USERNAME_PASS:
modemWrite(“AT+QFTPCFG="account","”);
modemWrite(ftpUser);
modemWrite(“","”);
modemWrite(ftpPass);
modemWrite(“"\r\n”);
break;
case OPEN:
modemWrite(“AT+QFTPOPEN="”);
modemWrite(ipAddress);
modemWrite(“",”);
modemWrite(portString);
modemWrite(“\r\n”);
break;
case FILELIST:
modemWrite(“AT+QFTPNLST="/"\r\n”);
break;
case SETPATH:
modemWrite(“AT+QFTPCWD="/"\r\n”);
break;
case GETFILE:
modemWrite(“AT+QFTPGET="Test4G.txt","COM:"\r\n”);
break;

Please provide the complete FTP connection process

void processFtpCommands(void)
{
if(ftpStatus == BEGIN && strstr(rx1Buff, “OK”) != NULL)
{
debugWrite(“Jump to QIACT\n”);
ftpStatus = CONFIGURE;
}
else if(ftpStatus == CONFIGURE && strstr(rx1Buff, “OK”) != NULL)
{
debugWrite(“Jump to username_pass\n”);
ftpStatus = USERNAME_PASS;
}
else if(ftpStatus == USERNAME_PASS && strstr(rx1Buff, “OK”) != NULL)
{
ftpStatus = TIMEOUT;
}
else if(ftpStatus == TIMEOUT && strstr(rx1Buff, “OK”) != NULL)
{
ftpStatus = TRANSMODE;
}
else if(ftpStatus == TRANSMODE && strstr(rx1Buff, “OK”) != NULL)
{
ftpStatus = FILETYPE;
}
else if(ftpStatus == FILETYPE && strstr(rx1Buff, “OK”) != NULL)
{
ftpStatus = OPEN;
}
else if(ftpStatus == OPEN && strstr(rx1Buff, “OK”) != NULL)
{
debugWrite(“Jump to open wait…\n”);
ftpStatus = OPENWAIT;
}
else if(ftpStatus == OPENWAIT && strstr(rx1Buff, “+QFTPOPEN: 0”) != NULL)
{
debugWrite(“Jump to FILELIST…\n”);
ftpStatus = FILELIST;
}
else if(ftpStatus == FILELIST && strstr(rx1Buff, “OK”) != NULL)
{
debugWrite(“Jump to SETPATH.\n”);
ftpStatus = SETPATH;
}
else if(ftpStatus == SETPATH && strstr(rx1Buff, “+QFTPCWD:”) != NULL)
{
debugWrite(“Jump to CHECKPATH.\n”);
ftpStatus = CHECKPATH;
}
else if(ftpStatus == CHECKPATH && strstr(rx1Buff, “+QFTPPWD:”) != NULL)
{
debugWrite(“Jump to GETFILE.\n”);
ftpStatus = GETFILE;
}
else if(ftpStatus == GETFILE && strstr(rx1Buff, “OK” != NULL)
{
debugWrite(“Get File Operations…”);
if(strstr(rx1Buff, “+QFTPGET:-”) != NULL)
{
ftpStatus = DISCONNECT;
}
else
{
debugWrite(“Downloading…”);
ftpStatus = DOWNLOADING;
}
}
else if(ftpStatus == DOWNLOADING && strstr(rx1Buff, “+QFTPGET:”) != NULL)
{
debugWrite(“Downloading OK.”);
ftpStatus = DISCONNECT;
}
else if(ftpStatus == DISCONNECT && strstr(rx1Buff, “OK”) != NULL)
{
debugWrite(“DISCONNECT.”);
ftpStatus = DISCONNECTED;
ftpMode = 0;
state = CONNECTED;
resetDevice();
}
if(strstr(rx1Buff,“+QFTPOPEN: 606”)!=NULL){
debugWrite(“FTP process try again…”);
ftpStatus = BEGIN;
}
}