Hello
I'm using MQX 3.8 and Freescale K60 for a DataLogger application that uploads periodically files to a FTP server.
There is a specific task that calls FTP client functions:
- FTP_open
- FTP_command
- FTP_command_data
- FTP_close
exactly like in the ftpc_cmd shell commands.
The application works fine for days, and weeks and months, if the server answer correctly to all the requests.
But sometimes a wrong/missed answer or a connection lost or a link error leaves the task in the blocked state indefinitely.
- There are no stack or memory overflows.
- RTCS is still running correctly (ping/web server)
- MFS file system is correctly accessible
Note:
- sometimes task is blocked in the FTP_open function, before I could get the socket handler
- RTCS is RTCS_MINIMUM_FOOTPRINT except for
_RTCSPCB_init = 6; // 4;
_RTCSPCB_grow = 2;
_RTCSPCB_max = 20;
_RTCS_msgpool_init = 6; // 4;
_RTCS_msgpool_grow = 2;
_RTCS_msgpool_max = 20;
_RTCS_socket_part_init = 6; // 4;
_RTCS_socket_part_grow = 2;
_RTCS_socket_part_max = 20;
The only work around I found is to restart the task:
- blocking socket is "shutdown"
- memory and sockets frees (with no leak, seems)
Questions:
1) is this the correct way (safe and clean) to build a FTP client? (one socket, one client, one task..)
2) restarting tasks could generate memory leak problems and unpredictable long time RTU crash/reset (a DataLogger must avoid resets) : there is a way to change socket options in ftpc_cmd (OPT_RECEIVE_TIMEOUT) and handle timeouts in blocking mode?
3) why socket "blocks" forever? (OPT_TIMEWAIT_TIMEOUT is 1000)
Thanks
Hi Francesco,
MQX 4.1 implements a new FTP server (FTPsrv) which is improved from the MQX3.8 FTP srever. You can download MQX4.1 from www.freescale.com/mqx and you will also need to install Freescale MQX RTOS 4.1.0.1 Patch because this patch solves some issues detected.
Shell example (C:\Freescale\Freescale_MQX_4_1\rtcs\examples\shell) demonstrates many RTCS services including FTP, _README.txt file explains all of them.
You should try it.
Regards,
Carlos