FTP file creation

Hi,
I wrote an FTP client code . I am unable to establish connection. No tcp server is on the server side. there is an ftp server. suggest me what is wrong in it. i am using legato 16.07 on mangohred 750x module.
Thank You,
K Subrahmaniam

Maybe you can try this busybox for ftpget command and see if it works for you.busybox-armv5l_1.26 (1.1 MB)

./busybox-armv5l_1.26 ftpget 123.123.123.123 --username USER --password PASSWORD --port 21 --verbose data.txt

Hi,

Thank you,

I will try it.

K Subrahmaniam

Hi,
regarding ftp, I connected to the server through connect call, after that i send command ftp through send call . I got return value 220. then in order to login i used strcpy(msgbuf, “USER”) , strcat username to the command and then sent . I used snprintf function also. but again i got return value 220. through terminal I am able to connect to the server through commands curl ftp://ftpsit.com --user username:password.
I could not understand what is problem in the code. and please tell me where should i use this ./busybox-arm51_1.26 ftpget. suggest me any modifications in the code,
Thanks and regards,
K Subrahmaniam

didn’t you can run this command to check if the FTP connection is OK?
./busybox-armv5l_1.26 ftpget 123.123.123.123 --username USER --password PASSWORD --port 21 --verbose data.txt

Hi,

yes I checked , It replied busy box is not found. please suggest me.

Thanks and regards,

K Subrahmaniam

Did you transfer my busybox to module?

Hi,
I used that command what you have given. It shows busy box not found. But in code I got positive return values for user,pass,mode,type port and put commands . I used put filename ,and write call to send the file ,then server replied positive 200 and the content of the file what I have sent . But the file is not visible on the server side. I used send file call , then also I got same reply . Should I add any lines in adf file like sdcard unsandboxed .please guide me.
Thanks and regards,
K subrahmaniam

why did it show busy box not found?
Did you transfer my busybox to module?

Hi,
I used BusyBox what you have sent as a command .I got BusyBox not found . Please guide me
Thanks and regards ,
K Subrahmaniam

I don’t see such problem…

root@swi-mdm9x28:/tmp# ls
busybox-armv5l_1.26 libexec_wk thermal_engi_ipc
legato pkgdwl tmpfdbtable.txt
legato_logs psm_socket ulib
libexec sock0 ulib_wk
root@swi-mdm9x28:/tmp#
root@swi-mdm9x28:/tmp# ./busybox-armv5l_1.26 ftpget 123.123.123.123 --username xxx --password xxxxx --port 21 --verbose data.txt
-sh: ./busybox-armv5l_1.26: Permission denied
root@swi-mdm9x28:/tmp#
root@swi-mdm9x28:/tmp# chmod 777 ./busybox-armv5l_1.26
root@swi-mdm9x28:/tmp#
root@swi-mdm9x28:/tmp# ./busybox-armv5l_1.26 ftpget 123.123.123.123 --username xxx --password xxxxx --port 21 --verbose data.txt
Connecting to 123.123.123.123 (123.123.123.123 )
ftpget: cmd (null) (null)
ftpget: cmd USER xxx
ftpget: cmd PASS xxxxx
ftpget: cmd TYPE I (null)
ftpget: cmd PASV (null)
ftpget: cmd SIZE data.txt
ftpget: cmd RETR data.txt
ftpget: cmd (null) (null)
ftpget: cmd QUIT (null)
root@swi-mdm9x28:/tmp#
root@swi-mdm9x28:/tmp# ls
busybox-armv5l_1.26 libexec_wk tmpfdbtable.txt
data.txt pkgdwl ulib
legato psm_socket ulib_wk
legato_logs sock0
libexec thermal_engi_ipc

Hi @jyijyi
I used you script and ftpget to download a file from ftp server
When I used the command from terminal it works fine but when I used it through system() command it gives me an error ftpget: cmd PASV (null)
Sep 30 12:31:12 fx30 user.err Legato: =ERR= | AppFlash[6828] | ftpget: cmd SIZE tevvaSystem.wp76xx.update
Sep 30 12:31:12 fx30 user.err Legato: =ERR= | AppFlash[6828] | ftpget: cmd RETR tevvaSystem.wp76xx.update
Sep 30 12:31:13 fx30 user.err Legato: =ERR= | AppFlash[6828] | File size limit exceeded (core dumped)
Size of my file is 7MB and its a system update file.
Any hints for doing that?

Have you used unsandboxed feature in .adef file?

Yes I set sandbox : false

Should be “sandboxed: false”

Thanks @jyijyi it work
I want to keep the script permanently in my system how can I do that.
now I have placed in tmp and it is removed when I restart it.
Thanks

Put it in /home/root

1 Like

Using your given script ./busybox-armv5l_1.26 can I send a text file back to server as well?
I want to send some logs back to server?
Any hints?
@jyijyi

You mean back to ftp server?

Yes back to ftp server