FASTRACK SUPREME 10
OPENAT SDK 7.3
ftp-put example created from the Open AT project wizard, WIP , Version 5.10.2020, 256K, eclipse
After upload the data.txt file, i want to download anther file from the FTP server.
The code in data channel after update all the data is below:
case WIP_CEV_WRITE: {
int nwrite = wip_write( dst_data, buffer, sizeof( buffer) - offset);
if( nwrite < 0) { /*error*/ return; }
offset += nwrite; /* Update the number of bytes sent. */
if( offset == sizeof( buffer)) { /* All of [buffer] has been sent */
wip_debug( "Upload finish\n");
//wip_close( dst_data); //dst_data = NULL;
//wip_close( dst_ftp_cx); dst_ftp_cx = NULL;
[i][b] dst_data = wip_getFile(dst_ftp_cx, "test-1.txt", evh_data, NULL);
if(dst_data == NULL)
{
wip_debug( "Create download channel fail\r\n");
}
else
{
wip_debug( "Create download channel success\r\n");
}[/b][/i] }
break;
}
Debug messages got from the Uart:
[FTP<=] STOR data.txt
[FTP=>] “150 Opening BINARY mode data connection for data.txt.”
[WIP] new spawned TCPCLIENT 0x180c4b54
Upload finish
ERRLOG ftp.c:187: returned NULL
Create download channel fail
[WIP] closing CHANNEL 0x180c4ad4
If close the data channel by calling wip-close(), before wip_getFile.
if( offset == sizeof( buffer)) { /* All of [buffer] has been sent */
wip_debug( "Upload finish\n");
wip_close( dst_data); dst_data = NULL;
//wip_close( dst_ftp_cx); dst_ftp_cx = NULL;
[i][b] dst_data = wip_getFile(dst_ftp_cx, "test-1.txt", evh_data, NULL);
if(dst_data == NULL)
{
wip_debug( "Create download channel fail\r\n");
}
else
{
wip_debug( "Create download channel success\r\n");
The debug messages are:
[FTP<=] STOR data.txt
[FTP=>] “150 Opening BINARY mode data connection for data.txt.”
[WIP] new spawned TCPCLIENT 0x180c4b54
Upload finish
ERRLOG ftp.c:187: returned NULL
Create download channel fail
[WIP] closing CHANNEL 0x180c4ad4
[WIP] closing TCPCLIENT 0x180c4b54
[WIP] closing WRAPPER 0x180c4a34
[FTP=>] “226 Transfer complete.”
The question is : how to dowload file from server after upload one file? Any sample code? Thanks a lot.