LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FTP transfer progress bar

I'm trying to write an FTP application by using FTP library provided with LabVIEW Internet Toolkit library.  I have a large file (>1GB) that I want to transfer from PXI Real-time controller to my host computer running Windows XP.  On my windows machine I would like to show the users the progress bar and percent of the file being transferred just like the FTP windows provided by MAX from NI. Please See the attached screen capture.  How do I accomplished that?

 

Thanks!

0 Kudos
Message 1 of 10
(7,817 Views)
Adding screen capture from NI MAX FTP window.
0 Kudos
Message 2 of 10
(7,798 Views)

Hi,

 

Without knowing a bit more information, here is the general approach.  Get the original file size using one of the file IO primitives.  Then if you send the file by pieces / fixed No of bytes in some sort of loop you divide as follows (bytes sent/File Size)*100% and wire that data value to the progress bar indicator inside the transmit loop.  Havent got LV on this PC so cant give you much more info i'm afraid.

 

Craig

LabVIEW 2012
0 Kudos
Message 3 of 10
(7,767 Views)

A full featured progress bar can be found in the LAVA Code Repository

 

You can use it as is or just get the idea how to make a progress bar... 

 

Felix 

0 Kudos
Message 4 of 10
(7,749 Views)

The low level file transfer is performed in vi.lib\addons\internet\utils\tcputil.llb\TCP Write Stream.vi

 

There is a shift register that contains the bytes left unwritten that could be used to determine the progress.

 

Issues:

 

You would need to modify this VI to expose the bytes left unwritten to your UI.  In general, its not a good idea to change NI supplied VIs.

 

This VI is reentrant. It may be possible to have more than one FTP transfer happening at the same time; so using a LabVIEW global to expose the value would not be a good idea.

 


 

 

0 Kudos
Message 5 of 10
(7,738 Views)

PhillipBrooks, thanks for pointing to the right direction.  I am using vi.lib\addons\internet\ftp\ftp1.llb\FTP [RETR].vi to do an FTP Get.  Within that VI, there's a TCP Read Stream.vi instead of the TCP Write Stream.vi that you suggested.  Since the chunk size control is default at 4096 bytes, do you think it's wise to add a global inside that read tcp loop to determine the number of bytes read so far (i.e bytesReadSoFar = (IterationCount + 1) * 4096).  Of course, in my user status GUI progress bar, i would do a periodic read on that global and divide by the size of the file being transfer to show the user the percentage completed.  What's your approach?

0 Kudos
Message 6 of 10
(7,707 Views)

As I mentioned before, I don't like to modify the original NI vi libraries.  If you upgrade your version of LabVIEW, you will need to add your changes again...

 

The simplest solution would be the global. All you would have to do is write to the global inside 'TCP Read Stream.vi'. You could add a read of the global to your UI and be done.

 

If you are running this UI on multiple machines using the development environment, you will need to copy the upgraded vi.lib\addons\internet\ftp\ftp1.llb file to these machines...

0 Kudos
Message 7 of 10
(7,681 Views)

I know that's a quite old thread but I'm running into it now....

so I came up to two solutions:

1. "quick and dirty" using winSCP thru cmd - at least the user sees the progress and remaining time

tcie_1-1603570132046.png

2. "slow and better" - you can control real time the size of the file on FTP or in local folder with second parallel loop - before transfer you store the size of the file and during the transfer you refresh local or remote file size

 

0 Kudos
Message 8 of 10
(3,870 Views)

I've often gone the PhillipBrooks method in the past.  Make a new copy of the low level function in the .llb he referenced.  Then put in a VIG that writes what the percentage complete is based on the number of bytes transferred, and the total file size.  Then just read the VIG value when I want to know the amount complete.  You can get more advanced with transferring multiple files and have two progress bars, indicating what the current file progress and overall progress is.

0 Kudos
Message 9 of 10
(3,810 Views)

Here's what I use.

"If you weren't supposed to push it, it wouldn't be a button."
Message 10 of 10
(3,800 Views)