Mike C Posted November 27, 2007 Author Report Share Posted November 27, 2007 Hello all. I am using FTP to tranfer a file from a remote server. I want to be able to monitor the download progress but I don't know how to do that. Getting the file size is not a problem, but how can I find out how much data has been trasferred at a given point during the download? Thanks in advance for all the help. MikeC Quote Link to comment
Mike C Posted November 27, 2007 Report Share Posted November 27, 2007 Hello all. I am using FTP to tranfer a file from a remote server. I want to be able to monitor the download progress but I don't know how to do that. Getting the file size is not a problem, but how can I find out how much data has been trasferred at a given point during the download? Thanks in advance for all the help. MikeC Quote Link to comment
Aristos Queue Posted November 27, 2007 Report Share Posted November 27, 2007 QUOTE(Mike C @ Nov 26 2007, 11:30 AM) Hello all. I am using FTP to tranfer a file from a remote server. I want to be able to monitor the download progress but I don't know how to do that. Getting the file size is not a problem, but how can I find out how much data has been trasferred at a given point during the download? I would doubt it unless you've got some way of monitoring the packet transfers directly on the FTP port. Quote Link to comment
Aristos Queue Posted November 27, 2007 Report Share Posted November 27, 2007 QUOTE(Mike C @ Nov 26 2007, 11:30 AM) Hello all. I am using FTP to tranfer a file from a remote server. I want to be able to monitor the download progress but I don't know how to do that. Getting the file size is not a problem, but how can I find out how much data has been trasferred at a given point during the download? I would doubt it unless you've got some way of monitoring the packet transfers directly on the FTP port. Quote Link to comment
Justin Goeres Posted November 27, 2007 Report Share Posted November 27, 2007 QUOTE(Mike C @ Nov 26 2007, 10:30 AM) Hello all. I am using FTP to tranfer a file from a remote server. I want to be able to monitor the download progress but I don't know how to do that. Getting the file size is not a problem, but how can I find out how much data has been trasferred at a given point during the download? If you're using a command-line FTP client, it might output its status to stdout. If you can get the client to send that output continuously to a file, you might be able to poll that file from your application and parse out the most current information. That's all kinds of ugly, though, and pretty unlikely to work . Another option, if you know the size of the file you're downloading in advance and the local filename you're downloading to, would be to just poll the size of the local file as it's downloaded, and divide that by the total number of bytes you're expecting. This, too, depends a bit on your FTP client; if your client preallocates the file on disk it won't work. That's only half as ugly as my first suggestion. Quote Link to comment
Justin Goeres Posted November 27, 2007 Report Share Posted November 27, 2007 QUOTE(Mike C @ Nov 26 2007, 10:30 AM) Hello all. I am using FTP to tranfer a file from a remote server. I want to be able to monitor the download progress but I don't know how to do that. Getting the file size is not a problem, but how can I find out how much data has been trasferred at a given point during the download? If you're using a command-line FTP client, it might output its status to stdout. If you can get the client to send that output (or any other status) continuously to a file, you might be able to poll that file from your application and parse out the most current information. That's all kinds of ugly, though, and pretty unlikely to work . Another option, if you know the size of the file you're downloading in advance and the local filename you're downloading to, would be to just poll the size of the local file as it's downloaded, and divide that by the total number of bytes you're expecting. This, too, depends a bit on your FTP client; if your client preallocates the file on disk it won't work. That's only half as ugly as my first suggestion. Quote Link to comment
LAVA 1.0 Content Posted November 28, 2007 Report Share Posted November 28, 2007 QUOTE(Justin Goeres @ Nov 26 2007, 04:43 PM) If you're using a command-line FTP client, it might output its status to stdout. If you can get the client to send that output (or any other status) continuously to a file, you might be able to poll that file from your application and parse out the most current information. That's all kinds of ugly, though, and pretty unlikely to work . Use the 'hash' command in an FTP command line session to toggle the display of a '#' for every N bytes transferred. After commanding 'hash', your server should return a message indicating the number of bytes/hash mark. Your server sends the marks, so 'hash' must be implemented at the server. You can also use 'hash on' and 'hash off'. Example of hash marks: http://help.ids.net/ftp/ftpdos.asp I poked around in the LV 8.0 Internet Toolkit VIs and looked at the get file function. I don't see any opportunity to easily extract any progress info :thumbdown: ... Quote Link to comment
Mike C Posted November 28, 2007 Author Report Share Posted November 28, 2007 Thanks for the suggestion everyone. I am planning on using the Labview internet toolkit VIs for this project but was unable to find any output indicating how much data was received at any point in time. Justin's suggestion of polling the file size of the downloded file might work but I agree that it's not very elegant. How do other programs (FTP clients, browsers, download utilities, etc) know how much data was received? MikeC Quote Link to comment
Aristos Queue Posted November 28, 2007 Report Share Posted November 28, 2007 QUOTE(Mike C @ Nov 27 2007, 08:22 AM) How do other programs (FTP clients, browsers, download utilities, etc) know how much data was received? Other programs know the progress because they are the program doing the file transfer. They're the ones actively sitting on the port receiving packets, unzipping the headers and handling the packets accordingly. The LV Internet Toolkit VIs are doing this, but they are high level APIs (download this file) not low level APIs (wait for packet on port XYZ). You can write such VIs using the Internet toolkit and create your own implementation of the FTP protocol, which you would call to wait for one packet, update some display, then wait for the next packet. Wouldn't be trivial but it is possible. Quote Link to comment
Rolf Kalbermatter Posted November 28, 2007 Report Share Posted November 28, 2007 QUOTE(Mike C @ Nov 27 2007, 09:22 AM) Thanks for the suggestion everyone. I am planning on using the Labview internet toolkit VIs for this project but was unable to find any output indicating how much data was received at any point in time. Justin's suggestion of polling the file size of the downloded file might work but I agree that it's not very elegant. If you want to use the internet toolkit you certainly can go into the VI library and modify it in such a way to provide somehow some information in a global variable about the current size. The internet toolkit FTP VIs if you dig into them, does basically read multiple blocks inside a loop writing them to the desired file, until all data has been retrieved or the connection is aborted. There is no current progress information because the high level VI to download a file is written in such a way to only return on a finished download or on error. So there would be never a meaningful progress return value from that VI itself. The information you want to know is deeper inside that VI hierarchy and you will have to modify those VIs somewhat to give you that information in a meaningful way. Rolf Kalbermatter Quote Link to comment
Mike C Posted November 29, 2007 Author Report Share Posted November 29, 2007 QUOTE(rolfk @ Nov 27 2007, 04:41 PM) If you want to use the internet toolkit you certainly can go into the VI library and modify it in such a way to provide somehow some information in a global variable about the current size. The internet toolkit FTP VIs if you dig into them, does basically read multiple blocks inside a loop writing them to the desired file, until all data has been retrieved or the connection is aborted.There is no current progress information because the high level VI to download a file is written in such a way to only return on a finished download or on error. So there would be never a meaningful progress return value from that VI itself. The information you want to know is deeper inside that VI hierarchy and you will have to modify those VIs somewhat to give you that information in a meaningful way. Rolf Kalbermatter After Aristos' comment I started looking into the low level vis and found that there is a single vi (tcp read) in a loop that reads a specific amount of data (4kb by default) every iteration until the entire file is downloaded. I guess I need to do some rearraging in order to get the info I want. Thanks for all the help everyone. Mike C Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.