Problem with FTP protocol


#1

Hi,
I have problem with FTP protocol. I have follow steps:

  1. Connect to the service provider by calling ed_DialupConnectionStart () API.
  2. Set FTP parameters (i.e. FTP server name, FTP port, type etc) by calling ed_FTPSetConfig () API.
    I can’t set FTP parameters, ed_FTPSetConfig() returned error.
    My code is posted bellow:
void dialupHandler(s32 responseCode, TeDHandle id){
	
	adl_atSendResponse(ADL_AT_RSP, "\r\n ---> Inside dialupHandler\r\n");

	switch(responseCode){
		case ED_OK_GPRS_SESSION_SET:   //GPRS session is set.
			adl_atSendResponse(ADL_AT_RSP, "\r\nED_OK_GPRS_SESSION_SET");
			adl_tmrSubscribe(FALSE, 10, ADL_TMR_TYPE_100MS, ftpSetup);
		break;

		case ED_INFO_CONNECT:
			adl_atSendResponse(ADL_AT_RSP, "\r\nInside ED_INFO_CONNECT");
		break;

		case ED_OK_PPP:
			adl_atSendResponse(ADL_AT_RSP, "\r\nED_OK_PPP");
		break;

		case ED_OK_ON_HOOK:
			adl_atSendResponse(ADL_AT_RSP, "\r\nDial up connection closed");
			adl_atCmdCreate("AT+CGATT=0", FALSE, AttRspHandler, "*", NULL);
		break;

		case ED_ERR_GPRS_ABORTED:
			adl_atSendResponse(ADL_AT_RSP, "\r\nInternal GPRS error.Please check your APN parameters");
		break;

		default:
			adl_atSendResponse(ADL_AT_RSP, "\r\nERROR received in dial up connection start");
		break;
	}
}





void ftpSetup(void){
	adl_atSendResponse(ADL_AT_RSP, "\r\n ---> ftpSetup()\r\n");

	FTPParams.FtpPort = 21;
	wm_strcpy(FTPParams.FtpType, "I");
	wm_strcpy(FTPParams.FtpServ, ".........");  
	wm_strcpy(FTPParams.FtpUn,   ".........");
	wm_strcpy(FTPParams.FtpPw,   ".........");
	
        returnCode = ed_FTPSetConfig(&FTPParams);
	wm_sprintf(buffer, "\r\n ed_FTPSetConfig: %d", returnCode);
	adl_atSendResponse(ADL_AT_RSP, buffer);

}

Can anybody help me to connect on FTP server?
Thank in advanced,
belikg


#2

I don’t know what’s your problem but I think you should test every error message of the handler function.


#3

is the struct FTPParams global?


#4

Yes, the struct FTPParams is global.


#5

Hi belikg,
Try the following code snippet for setting the FTP parameters:

FTPParams.FtpPort = 21;
FTPParams.FtpType= ‘I’;
FTPParams.FtpMode = 0;
wm_strcpy(FTPParams.FtpServ, “…”);
wm_strcpy(FTPParams.FtpUn, “…”);
wm_strcpy(FTPParams.FtpPw, “…”);

returnCode = ed_FTPSetConfig(&FTPParams);
wm_sprintf(buffer, “\r\n ed_FTPSetConfig: %d”, returnCode);
adl_atSendResponse(ADL_AT_RSP, buffer);

Hope this should solve your problem.

Best Regards,
Open AT Fan.