Newsletter
July 8, 2019 - 2:10pm, 8057 views
Is it possible to open an FTP connection through java? Do you have an example?
Hello,
yes, it can be done with the use of external libraries. Please check showcases from our forum:
https://iot-developer.thalesgroup.com/showcase/uart-ftp-pipe-example-java-midlet
https://iot-developer.thalesgroup.com/showcase/java-explicit-ftps-implementation-bouncycastle
Best regards,
Adam
Hello,
Thanks for your response.
before going to java I am trying to perform the donwload via command, although I am not getting.
My download don't start =/
IP address = 192.168.193.1
TCP port = 4545
Path = horus
File name = horus3g.hex
User = horusftp
password = a*** censored
= horus/hprus3g.hex
AT^SISS=1,srvType,"Ftp"
AT^SISS=1,conId,"1"
AT^SISS=1,address,"ftp://192.168.193.1:4545/horus"
AT^SISS=1,user,"horusftp"
AT^SISS=1,passwd,"a*****"
AT^SISS=1,path,"file:///a:/"
AT^SISS=1,cmd,"fget"
AT^SISS=1,files,"horus3g.hex"
AT^SISO=1
AAT script: start
AT+COPS?
AT+COPS?
+COPS: 0,0,"VIVO",2
OK
AT+CSQ
AT+CSQ
+CSQ: 6,99
OK
AT+CGATT=1
AT+CGATT=1
OK
at+cgdcont=1,"IP","lupa.vivo.com.br","",0,0
at+cgdcont=1,"IP","lupa.vivo.com.br","",0,0
OK
AT^SGAUTH?
AT^SGAUTH?
^SGAUTH: 1,1,"vivo@lupa"
^SGAUTH: 4,1,"oi"
OK
AT^SGAUTH = 1,1,"vivo@lupa","lupa"
AT^SGAUTH = 1,1,"vivo@lupa","lupa"
OK
AT^sica=1,1
AT^sica=1,1
OK
at+cgpiaf=1,1,0,1
at+cgpiaf=1,1,0,1
OK
at+cgpaddr
at+cgpaddr
+CGPADDR: 1,"172.18.165.71"
+CGPADDR: 4,"0.0.0.0"
OK
AT script: end
AT script: start
at^siss=0,alphabet,"1"
at^siss=0,alphabet,"1"
OK
AT^SISS=1,srvType,"Ftp"
AT^SISS=1,srvType,"Ftp"
OK
AT^SISS=1,conId,"1"
AT^SISS=1,conId,"1"
OK
AT^SISS=1,address,"ftp://192.168.193.1:4545/horus"
AT^SISS=1,address,"ftp://192.168.193.1:4545/horus"
OK
AT^SISS=1,user,"horusftp"
AT^SISS=1,user,"horusftp"
OK
AT^SISS=1,passwd,"a****"
AT^SISS=1,passwd,"a******"
OK
AT^SISS=1,path,"file:///a:/"
AT^SISS=1,path,"file:///a:/"
OK
AT^SISS=1,cmd,"fget"
AT^SISS=1,cmd,"fget"
OK
AT^SISS=1,files,"horus3g.hex"
AT^SISS=1,files,"horus3g.hex"
OK
AT^SISO=1
AT^SISO=1
OK
AT script: end
Hello,
you had good idea to check connection using AT commands before going to java. Please let me know, do you use PLS62 module? How long do you wait after sending SISO=1 command? Are you sure this server works fine if you try to connect to it from browser or e.g. filezilla?
Thanks,
Adam
Hello,
Thanks for your help Adam
Yes the module model is PLS62 - W and the server is filezilla, after a few tries and with the following commands it worked !!!
AT^SISS=1,srvType,"Ftp"
AT^SISS=1,conId,"2"
AT^SISS=1,alphabet,"1"
AT^SISS=1,address,"ftp://horusftp:a******@192.168.193.1:4545/horus"
AT^SISS=1,cmd,"fget"
AT^SISS=1,files,"horus3g.hex"
AT^SISO=1
My only question now is how to enable the URC's, because although I can download the file I do not have any information
at^scfg?
^SCFG: "GPRS/AutoAttach","enabled"
^SCFG: "Gpio/mode/ASC1","std"
^SCFG: "Gpio/mode/DCD0","gpio"
^SCFG: "Gpio/mode/DSR0","rsv"
^SCFG: "Gpio/mode/DTR0","gpio"
^SCFG: "Gpio/mode/FSR","std"
^SCFG: "Gpio/mode/HWAKEUP","rsv"
^SCFG: "Gpio/mode/PULSE","gpio"
^SCFG: "Gpio/mode/PWM","gpio"
^SCFG: "Gpio/mode/RING0","gpio"
^SCFG: "Gpio/mode/SPI","rsv"
^SCFG: "Gpio/mode/SYNC","gpio"
^SCFG: "Ident/Manufacturer","Cinterion"
^SCFG: "Ident/Product","PLS62-W"
^SCFG: "MEShutdown/Fso","1"
^SCFG: "MEShutdown/sVsup/threshold","0","0"
^SCFG: "MEopMode/CFUN","0","1"
^SCFG: "MEopMode/CregRoam","0"
^SCFG: "MEopMode/ExpectDTR","current"
^SCFG: "MEopMode/ExpectDTR","powerup"
^SCFG: "MEopMode/Prov/AutoSelect","off"
^SCFG: "MEopMode/Prov/Cfg","attus"
^SCFG: "MEopMode/RingOnData","off"
^SCFG: "MEopMode/SoR","off"
^SCFG: "MeOpMode/SRPOM","0"
^SCFG: "Radio/Band/2G","0x00000074"
^SCFG: "Radio/Band/3G","0x0004019B"
^SCFG: "Radio/Band/4G","0x080E08DF"
^SCFG: "Radio/Mtpl/2G","0"
^SCFG: "Radio/Mtpl/3G","0"
^SCFG: "Radio/Mtpl/4G","0"
^SCFG: "Radio/OutputPowerReduction","4"
^SCFG: "RemoteWakeUp/Ports","current"
^SCFG: "RemoteWakeUp/Ports","powerup"
^SCFG: "Serial/Ifc","0"
^SCFG: "Serial/Interface/Allocation","1","1"
^SCFG: "Serial/USB/DDD","0","0","0409","1E2D","005B","Cinterion Wireless Modules","PLSx",""
^SCFG: "Tcp/IRT","3"
^SCFG: "Tcp/MR","10"
^SCFG: "Tcp/OT","6000"
^SCFG: "Tcp/WithURCs","on"
^SCFG: "Trace/Syslog/OTAP","0"
^SCFG: "Urc/Ringline","local"
^SCFG: "Urc/Ringline/ActiveTime","2"
^SCFG: "Userware/Autostart","1"
^SCFG: "Userware/Autostart/Delay","0"
^SCFG: "Userware/DebugInterface","0.0.0.0","0.0.0.0","0"
^SCFG: "Userware/DebugMode","on"
^SCFG: "Userware/Passwd",
^SCFG: "Userware/Stdout","null",,,,"off"
^SCFG: "Userware/Watchdog","0"
OK
Best regards
Italo
Hello Italo,
Great to hear it works! From your SCFG commands I can see you have URCs enabled (^SCFG: "Tcp/WithURCs","on"). How do you verify that file was downloaded succesfully? Please check below my logs:
at^siss?
^SISS: 0,"srvType","Ftp"
^SISS: 0,"conId","1"
^SISS: 0,"address","ftp://user:password@address"
^SISS: 0,"tcpMR","10"
^SISS: 0,"tcpOT","6000"
^SISS: 0,"path","file:///a:/"
^SISS: 0,"files","16bytes.txt"
^SISS: 0,"cmd","fget"
^SISS: 1,"srvType",""
^SISS: 2,"srvType",""
^SISS: 3,"srvType",""
^SISS: 4,"srvType",""
^SISS: 5,"srvType",""
^SISS: 6,"srvType",""
^SISS: 7,"srvType",""
^SISS: 8,"srvType",""
^SISS: 9,"srvType",""
OK
at^siso=0
OK
^SIS: 0,0,2100,"Ftp open(address:21)"
^SIS: 0,0,2100,"220 My FTP Server"
^SIS: 0,0,2100,"FTP Login OK"
^SIS: 0,0,2100,"fget 16bytes.txt"
^SIS: 0,0,2100,"DISK Free: 7872512 Total: 33366016"
^SIS: 0,0,2100,"FGET: 16bytes.txt 16 bytes"
^SISR: 0,2
^SIS: 0,0,2100,"221 Goodbye."
As you can see I got URC with information that connection is open, login is ok and file is downloades succesfully.
You can verify that file is donwloades by following command:
AT^SFSA="ls","a:/"
It will return all files from module memory.
Best regards,
Adam
Hello.
My commands are exactly the same as yours, the only thing I do not have is the URC's of the SISO command.
My intention is to verify that the download has been completed, then verify the integrity of the downloaded file and then have the module update
AT script: start
AT^SISS=1,srvType,"Ftp"
AT^SISS=1,srvType,"Ftp"
OK
AT^SISS=1,conId,"2"
AT^SISS=1,conId,"2"
OK
AT^SISS=1,alphabet,"1"
AT^SISS=1,alphabet,"1"
OK
AT^SISS=1,address,"ftp://horusftp:a*****@192.168.193.1:4545/horus"
AT^SISS=1,address,"ftp://horusftp:a*****@192.168.193.1:4545/horus"
OK
AT^SISS=1,cmd,"fget"
AT^SISS=1,cmd,"fget"
OK
AT^SISS=1,files,"horus3g.hex"
AT^SISS=1,files,"horus3g.hex"
OK
AT script: end
AT^SISS?
AT^SISS?
^SISS: 0,"srvType",""
^SISS: 1,"srvType","Ftp"
^SISS: 1,"conId","2"
^SISS: 1,"alphabet","1"
^SISS: 1,"address","ftp://horusftp:a****@192.168.193.1:4545/horus"
^SISS: 1,"tcpMR","10"
^SISS: 1,"tcpOT","6000"
^SISS: 1,"path","file:///a:/"
^SISS: 1,"files","horus3g.hex"
^SISS: 1,"cmd","fget"
^SISS: 2,"srvType",""
^SISS: 3,"srvType",""
^SISS: 4,"srvType",""
^SISS: 5,"srvType",""
^SISS: 6,"srvType",""
^SISS: 7,"srvType",""
^SISS: 8,"srvType",""
^SISS: 9,"srvType",""
OK
AT^SISO=1
OK
Hi,
It's very strange that you don't have URCs. I'm afraid maybe module does not connect to the server. Could you please check AT^SISI? after AT^SISO? command to verify connection status? If module is really connected, state should be "4", if it will be in connecting state, this command will return "3".
Could you please check AT^SFSA="ls","a:/" command to verify that file "horus3g.hex" is on the module memory?
Thanks,
Adam
Hello,
Thanks for your help Adam
I monitored the server-side connection, and I was able to view the module by performing the download request and downloading the file. below will the commands you requested
AT^SFSA="ls","a:/"
AT^SFSA="ls","a:/"
^SFSA: "Horus.jad"
^SFSA: "Horus.jar"
^SFSA: "horus3g.hex"
^SFSA: 0
OK
AT^SISI?
^SISI: 1,"Ftp"
OK
AT^SISO?
^SISO: 0,""
^SISO: 1,"Ftp"
^SISO: 2,""
^SISO: 3,""
^SISO: 4,""
^SISO: 5,""
^SISO: 6,""
^SISO: 7,""
^SISO: 8,""
^SISO: 9,""
OK
Thanks,
Italo
Hello !
Do you tried also with some other server like public test server: https://dlptest.com/ftp-test/
Could you share results with that ?
Best Regards
Wojciech
Hello!
I have not been able to connect my module to this public server, but here is the log of the commands I'm using and log on the server side.
As I will use this server to efload the download of the java updates when module is in the field, I need to at least know when the download is completed to start the update process.
AT^SISS=0,srvType,"Ftp"
AT^SISS=0,srvType,"Ftp"
OK
AT^SISS=0,conId,"1"
AT^SISS=0,conId,"1"
OK
AT^SISS=0,alphabet,"1"
AT^SISS=0,alphabet,"1"
OK
AT^SISS=0,address,"ftp://horusftp:*****@192.168.193.1:4545/horus" password censored
AT^SISS=0,address,"ftp://horusftp:*****@192.168.193.1:4545/horus"
OK
AT^SISS=0,cmd,"fget"
AT^SISS=0,cmd,"fget"
OK
AT^SISS=0,files,"Horus4G.jad"
AT^SISS=0,files,"Horus4G.jad"
OK
AT^SISO=0
AT^SISO=0
OK
at^siss?
^SISS: 0,"srvType","Ftp"
^SISS: 0,"conId","1"
^SISS: 0,"alphabet","1"
^SISS: 0,"address","ftp://horusftp:*******@192.168.193.1:4545/horus"
^SISS: 0,"tcpMR","10"
^SISS: 0,"tcpOT","6000"
^SISS: 0,"path","file:///a:/"
^SISS: 0,"files","Horus4G.jad"
^SISS: 0,"cmd","fget"
^SISS: 1,"srvType",""
^SISS: 2,"srvType",""
^SISS: 3,"srvType",""
^SISS: 4,"srvType",""
^SISS: 5,"srvType",""
^SISS: 6,"srvType",""
^SISS: 7,"srvType",""
^SISS: 8,"srvType",""
^SISS: 9,"srvType",""
OK
AT^SISO?
^SISO: 0,"Ftp",4,2,0,0,"172.18.200.162:4097","192.168.193.1:4545"
^SISO: 1,""
^SISO: 2,""
^SISO: 3,""
^SISO: 4,""
^SISO: 5,""
^SISO: 6,""
^SISO: 7,""
^SISO: 8,""
^SISO: 9,""
OK
AT^SFSA="ls","a:/"
AT^SFSA="ls","a:/"
^SFSA: "Horus.jad"
^SFSA: "Bootloader.jad"
^SFSA: "Bootloader.jar"
^SFSA: "Horus.jar"
^SFSA: "backupFirmware/"
^SFSA: "teste.txt"
^SFSA: "Horus4G.jad"
^SFSA: 0
OK
AT^SISC=0
AT^SISC=0
OK
AT^SISO=0
AT^SISO=0
OK
AT^SISO?
AT^SISO?
^SISO: 0,"Ftp",6,1,330,0,"172.18.200.162:4101","192.168.193.1:4545"
^SISO: 1,""
^SISO: 2,""
^SISO: 3,""
^SISO: 4,""
^SISO: 5,""
^SISO: 6,""
^SISO: 7,""
^SISO: 8,""
^SISO: 9,""
OK
AT^SISE=0
^SISE: 0,0
OK
AT^SISS=0,cmd,"dir"
AT^SISS=0,cmd,"dir"
OK
AT^SISS?
AT^SISS?
^SISS: 0,"srvType","Ftp"
^SISS: 0,"conId","1"
^SISS: 0,"alphabet","1"
^SISS: 0,"address","ftp://horusftp:******@192.168.193.1:4545/horus"
^SISS: 0,"tcpMR","10"
^SISS: 0,"tcpOT","6000"
^SISS: 0,"path","file:///a:/"
^SISS: 0,"files","Horus4G.jad"
^SISS: 0,"cmd","dir"
^SISS: 1,"srvType",""
^SISS: 2,"srvType",""
^SISS: 3,"srvType",""
^SISS: 4,"srvType",""
^SISS: 5,"srvType",""
^SISS: 6,"srvType",""
^SISS: 7,"srvType",""
^SISS: 8,"srvType",""
^SISS: 9,"srvType",""
OK
AT^SISO=0
AT^SISO=0
OK
AT^SISO?
AT^SISO?
^SISO: 0,"Ftp",4,2,0,0,"172.18.200.162:4106","192.168.193.1:4545"
^SISO: 1,""
^SISO: 2,""
^SISO: 3,""
^SISO: 4,""
^SISO: 5,""
^SISO: 6,""
^SISO: 7,""
^SISO: 8,""
^SISO: 9,""
OK
AT^SISE=0
AT^SISE=0
^SISE: 0,0
OK
at^scfg?
at^scfg?
^SCFG: "GPRS/AutoAttach","enabled"
^SCFG: "Gpio/mode/ASC1","std"
^SCFG: "Gpio/mode/DCD0","gpio"
^SCFG: "Gpio/mode/DSR0","rsv"
^SCFG: "Gpio/mode/DTR0","std"
^SCFG: "Gpio/mode/FSR","std"
^SCFG: "Gpio/mode/HWAKEUP","rsv"
^SCFG: "Gpio/mode/PULSE","gpio"
^SCFG: "Gpio/mode/PWM","gpio"
^SCFG: "Gpio/mode/RING0","gpio"
^SCFG: "Gpio/mode/SPI","rsv"
^SCFG: "Gpio/mode/SYNC","gpio"
^SCFG: "Ident/Manufacturer","Cinterion"
^SCFG: "Ident/Product","PLS62-W"
^SCFG: "MEShutdown/Fso","1"
^SCFG: "MEShutdown/sVsup/threshold","0","0"
^SCFG: "MEopMode/CFUN","0","1"
^SCFG: "MEopMode/CregRoam","0"
^SCFG: "MEopMode/ExpectDTR","current"
^SCFG: "MEopMode/ExpectDTR","powerup"
^SCFG: "MEopMode/Prov/AutoSelect","off"
^SCFG: "MEopMode/Prov/Cfg","attus"
^SCFG: "MEopMode/RingOnData","off"
^SCFG: "MEopMode/SoR","off"
^SCFG: "MeOpMode/SRPOM","0"
^SCFG: "Radio/Band/2G","0x00000074"
^SCFG: "Radio/Band/3G","0x0004019B"
^SCFG: "Radio/Band/4G","0x080E08DF"
^SCFG: "Radio/Mtpl/2G","0"
^SCFG: "Radio/Mtpl/3G","0"
^SCFG: "Radio/Mtpl/4G","0"
^SCFG: "Radio/OutputPowerReduction","4"
^SCFG: "RemoteWakeUp/Ports","current"
^SCFG: "RemoteWakeUp/Ports","powerup"
^SCFG: "Serial/Ifc","0"
^SCFG: "Serial/Interface/Allocation","1","1"
^SCFG: "Serial/USB/DDD","0","0","0409","1E2D","005B","Cinterion Wireless Modules","PLSx",""
^SCFG: "Tcp/IRT","3"
^SCFG: "Tcp/MR","10"
^SCFG: "Tcp/OT","6000"
^SCFG: "Tcp/WithURCs","on"
^SCFG: "Trace/Syslog/OTAP","0"
^SCFG: "Urc/Ringline","local"
^SCFG: "Urc/Ringline/ActiveTime","2"
^SCFG: "Userware/Autostart","1"
^SCFG: "Userware/Autostart/Delay","0"
^SCFG: "Userware/DebugInterface","0.0.0.0","0.0.0.0","0"
^SCFG: "Userware/DebugMode","on"
^SCFG: "Userware/Passwd",
^SCFG: "Userware/Stdout","usb2",,,,"off"
^SCFG: "Userware/Watchdog","0"
OK
ati1
Cinterion
PLS62-W
REVISION 02.000
A-REVISION 01.000.03
OK
Best Regards
italo
Pages