Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

FTP failed with Explicit FTP over TLS


Thein Dec 1, 2015 12:20 PM

Hi,

I'm trialing a program using CR1000 datalogger and GPRS Modem to FTP the file usng my company ftp server which is subsrcibed under Yahoo Small Business. I noted from the FileZilla ftp Client, for my company server I have to use Explicit FTP over TLS as it does not work on plain text FTP. Following is sever replied from MS shell cmd:-

C:\Users\user>ftp
ftp> open ftp.company.com
Connected to premium8.secure.ftps.geo.asbs.yahoodns.net.
220-Welcome to the Yahoo! Web Hosting FTP server
220-Need help? Get all details at:
220-http://help.luminate.com/help/us/webhosting/gftp/
220-
220-No anonymous logins accepted.
220-Yahoo!
220-Local time is now 21:08. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 5 minutes of inactivity.
User (premium8.secure.ftps.geo.asbs.yahoodns.net:(none)): name@company.com
421 Sorry, cleartext sessions are not accepted on this server.
Please reconnect using SSL/TLS security mechanisms.
Connection closed by remote host.
ftp>

Then I tried with following program:-

Public P3Open As String, P3Close, Batt, PTemp, Tries
Public OutStat As Boolean, SendIt As Boolean, SentOK As Boolean
Public LastFileName As String * 30
Public NewFileName As String * 30
Const FTPServer = "ftp.company.com"
Const FTPUser = "name@company.com"
Const FTPPwd = "password"
Const DestPath = "/DataLoggers/PBA1/"
Const MaxTries = 3

DataTable(Table1,True,-1)
DataInterval(0,1,Min,10)
TableFile ("USR:PB1Test",8,24,0,10,Min,OutStat,LastFileName)
Sample(1,Batt,FP2)
Sample(1,PTemp,FP2)
EndTable

BeginProg
SetStatus("UsrDriveSize","500000")
SW12(1)
Delay(1,15,Sec)
Scan (15,Sec,3,0)
Battery(Batt)
PanelTemp(PTemp,_60Hz)
CallTable Table1

If OutStat Then
SendIt = True
SentOK = False
Tries = 0
NewFileName = LastFileName
NewFileName = Replace(NewFileName,"USR:","")
NewFileName = DestPath & NewFileName
EndIf
NextScan

SlowSequence
Scan (30,Sec,3,0)
If SendIt Then
P3Open = PPPOpen
SentOK = FTPClient (FTPServer,FTPUser,FTPPwd,LastFileName,NewFileName,12)
Tries = Tries + 1
If SentOK OR Tries = 3 Then
SendIt = False
P3Close = PPPClose
P3Open = "0.0.0.0"
EndIf
EndIf
NextScan
EndProg

I tired using PutGetOption of 0, 2, 10 & 12, none of these can successfully transfer to my company ftp. But I can successfully transfer with PutGetOption 2 or 12 to the other FTP strage provider "HostedFTP". Can somebody advise to me which code I have to change in FTPClient (..........) especially PutGetOption code for my company ftp server which is under Yahoo Small Business?

Thank you,

* Last updated by: Thein on 12/1/2015 @ 5:26 AM *


GaryTRoberts Dec 2, 2015 09:47 PM

Thein,

Options 10 and 12 are what you are looking for.

Just guessing, it looks like you might be caught in one of those modem traps where the datalogger and the FTP server are both behind firewalls.

If the FTP server is behind a firewall, the client(datalogger) can't be behind a firewall and needs to use ACTIVE mode (client asks the server to connect to its (logger) IP address and port for the data connection). If the client (datalogger) is behind the firewall, the server can't be and the server controls were the data port connection is (to itself). PASV is used here.

If your modem works like our Raven modems, when the datalogger is connected via PPP, the datalogger is setup behind the modem's firewall and placed on a private network. In this case PASV can’t be used because of the modem’s firewall rules. If the server is also behind a firewall, rules prevent ACTIVE mode from working most times. So we can never get a data port connection.

There are a few things we can do to troubleshoot this:

1 -For the FTP client instruction to work, the GPRS modem and the datalogger also have to be in PPP mode. Make sure things are setup for PPP and it is working.

2- set SentOK = FTPClient . What does SentOK show after the FTPClient instruction runs. The results let you know what is going on. The details of the result codes can be found in CRBasic’s help.

3- Trace what is going on using the datalogger terminal. Using the W command and listening on the PPP port or TCP/IP port will show you exactly what is going on between the server and the logger.

4- Take a peek at the FTP server’s logs. These are in plain text and should give good detail as to what is going on.

5- See if the modem has a setting to allow the external IP address to be given to the device connected to it.

I hope these help.


Thein Dec 3, 2015 12:49 AM

Dear Gary,

Thanks for your feed back. It works after up grading to OS 28.02 with option 12 to save and option 19 to append the file to my company FTP server, and streaming also works. But FYI all 0, 2, 9, 10, 12 & 19 did not work on my company FTP server under OS 27.02, it's worth to note.

For other users I reply you queries as follows:-
1) Datalogger set up for PPP is on Com2 with baud rate set to 115200, dial string is *99***1#, return string is CONNECT. Modem set up for IP is AT+CGDCONT=1,"IP","APNNAME",0,0,0 and Modem is connected at Com2 with Tx to Rx, Rx to Tx and G & Shield to G. Thinks these are correct settings as I can Send email and can send SMS.

2) SetOk was set As Boolen as such when FTPs fail always show False at OS 27.02. But when I upgrade to OS28.02, FTP is ok and when FTP success it shows True.

3) Recently only found out to use with Terminal Stimulator, during OS 27.02 I didn't know how to check. At OS28.02, when I listen to Com2, found out it can listen FTP server response as well as Tx, at the end it response "transfer complete" and "Bye".

4) Yes, can check what's going on.

5) I'm not sure how to check whether Modem is allowed external IP, I got modem response PPPOpen as an IP Address, "xxx.xxx.xxx.xxx" whet PPP is open. I think that's mean Modem is setup correctly.

Thank you very much. It's amazing to find out CR1000 can Email, FTP and SMS alternately. Now, I'm going to try to connect the logger remotely, both LoggerNet and logger is on Dynamic IP, can you give some advice on it.

Thank you.

* Last updated by: Thein on 12/2/2015 @ 6:00 PM *

Log in or register to post/reply in the forum.