LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FTP STOR command with REST capability

Hi folk,
I have a cRIO on a remote field, and I need that the program running on that platform periodically uploaded, through the internet, the data files to an FTP server.
I have used the FTP VIs included in the Internet Toolkit to develop this functionality and I am experiencing some problems.

 

During the uploading of files of medium or large size, via FTP, can happen that the FTP server closes the connection.
The reasons can be different, network operation exceeded the user-specified or system time limit, bandwidth usage is restricted or the bandwidth is limited, etc..
To overcome this issue the correct strategy is to reopen the FTP connection and to restart the upload from the point where it was interrupted.

 

It is very important to finish to upload only the remaining part of the file, and not to restart from the beginning, otherwise you could not end the upload if the FTP server closes the connection again and again.

 

For implementing the resume, the FTP protocol supports a number of commands:

SIZE <remote file-name>  Returns the size of a file (Binary mode) .
REST <file-size>         Sets the following STOR command to restart transfer

                         from the specified point.
STOR <remote file-name>  If anticipated from a REST command, store (upload)

                         only the part of the file starting from the

                         specified point.

 

At the present, it seams to me that the LabVIEW Internet Toolkit does not support the capability of FTP resume.

Furthermore, if during a FTP upload the connection is closed by the FTP server, the FTP [STOR].vi exits sometime with ambiguous errors.


Exit with a correct error:
Error 56 occurred at TCP Read in NI_InternetTK_Common_VIs.lvlib:TCP Read xTP Reply.vi:2->NI_InternetTK_FTP_VIs.lvlib:FTP Get Command Reply.vi:1->NI_InternetTK_FTP_VIs.lvlib:FTP Data Send.vi->NI_InternetTK_FTP_VIs.lvlib:FTP [STOR].vi

 

Possible reason(s):
LabVIEW:  The network operation exceeded the user-specified or system time limit.


Exit with an ambiguous error:
Error 54 occurred at TCP Open Connection in NI_InternetTK_FTP_VIs.lvlib:FTP Open Data Connection.vi->NI_InternetTK_FTP_VIs.lvlib:FTP Data Send.vi->NI_InternetTK_FTP_VIs.lvlib:FTP [STOR].vi

 

Possible reason(s):
LabVIEW:  The network address is ill-formed. Make sure the address is in a valid format. For TCP/IP, the address can be either a machine name or an IP address in the form xxx.xxx.xxx.xxx. If this error occurs when specifying a machine name, make sure the machine name is valid. Try to ping the machine name. Check that you have a DNS server properly configured.

Do you have idea or suggestion of how  realize an FTP STOR command with REST capability?

Thanks,
Asper

0 Kudos
Message 1 of 8
(4,703 Views)
I don't have access to labview right now. You could look at the devzone to see if someone has implemented that. One thing you could do is a system call to an FTP client that supports this.
=====================
LabVIEW 2012


0 Kudos
Message 2 of 8
(4,699 Views)

Hi SteveChandler
before to post I did several unsuccessful searches in the all NI site.
As I have stated at the beginning, I'm developing the code on a cRIO, i.e. a real-time operating system, calling a FTP client is not a solution.

More  ideas or suggestions,
Asper

0 Kudos
Message 3 of 8
(4,692 Views)
Ahh. Sorry but I don't knot anything about ctio.
=====================
LabVIEW 2012


0 Kudos
Message 4 of 8
(4,677 Views)

Unfortunately the best advice I could give you would be to make a copy of the FTP toolkit and add this functionality yourself. You should have most of the building blocks available to you so it should be fairly starightforward. You could reference the RFC (RFC 959 and RFC 3659 for extensions) for any specifics you need on the packet format. You will need to save some state information so you can resume your download from the correct point.

 

Would it be possible to use TFTP? This is much leaner and more likely to succeed if the other ends supports it. I recently wrote a very basic TFTP Write. I'm sure I could do the TFTP Read in short order. I'm still working on packaging it up in a distributable form but I could provide you with a basic VI if needed.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 8
(4,676 Views)

I was looking at the FTP code and it is pretty big. If you don't need multiple sessions and all of whatever else is in there it might be easier to just roll your own. And as Mark said you need to keep track of state somewhere.

=====================
LabVIEW 2012


0 Kudos
Message 6 of 8
(4,673 Views)

Hi Mark,

thanks for the advise, unfortunately the TFTP is not the solution because both it provides no authentication and it is rarely used by internet service providers.

 

Asper

0 Kudos
Message 7 of 8
(4,671 Views)

Could you send the file over the network from the crio to another system and do the FTP from there? Maybe then you could do the system call to an FTP client. May or may not work in your situation - just throwing out suggestions.

=====================
LabVIEW 2012


0 Kudos
Message 8 of 8
(4,668 Views)