03-09-2010 10:26 AM
I am using the internet tookit FTP vis. Is there any way to cancel an FTP operation while you are in the middle of it? For instance, if the user has requested a get file for a large file on an RT device but then you need to close the program or somemthing.
Right now we have a program on the pc communicating with a vi running on an RT device by shared variable. When the pc side wants to download files, it indicates this over shared variable to the RT device. The device prepares the list of files to request and sends that to the pc, it then goes into a wait state so that it isn't trying to record while the pc is downloading files. The pc goes through the list of files and FTP 'get file' s each one. When the pc is finished it indicates this to the RT device so it can continue recording. I would like to be able to cancel the ftp get file operation in the middle of it downloading a large file and then tell the crio to get back to what it was doing.
03-10-2010 12:10 AM
Hi rex1030,
you can change the vi's to your needs. Make a copy of the "old" vi's and rename the new ones.
To stop the "get file operation" you can simply close the TCP connection. The other side will get an error and you can react on it.
Mike
03-10-2010 12:17 PM
That sounds like what I need. It needs to be able to react to connection losses anyways so that could work. I wonder if I am allowed to post my soon to be created cancelable 'get file' on the community forum.
How do interact with the subvi while it is running? Like usually all the inputs go into a subvi, and it runs. If the inputs to it change while it is running it doesn't pay attention to that. So how do I interact with it to throw the cancel flag?
03-10-2010 12:49 PM
I posted an idea in the LabVIEW Idea Exchange requesting that the VISA function provide a method for aborting current operations. One of the comments there suggested this should be added to all the communication VIs such as the TCP and UDP VIs.
I hesitate to modify the code that ships with LabVIEW because rolling in any changes that may occur in the future is a pain in the butt.
03-10-2010 02:15 PM
03-10-2010 02:19 PM - edited 03-10-2010 02:19 PM
03-10-2010 02:57 PM - edited 03-10-2010 02:58 PM
rex1030 wrote:
Is there any way to pass data between a vi and a subvi that is running? Changing the value of a boolean while the subvi is running would be enough. Maybe shared variables?
There are lots of ways just like Raven mentioned. The trick though is that the subVI will need to have the programming support to detect the new data. If the subVI isn't looking for the data then it really doesn't matter if you change it. This is where a good design and some forethought come into play.
03-10-2010 03:54 PM
Thanks Raven.
I agree mark. It would have to be polling the cancel flag for changes and close the tcp connection when true.
Looking into the get file function there are many layers of subvis. I don't know how the subvis would handle the TCP connection suddenly being closed, so that error would have to be handled as well.
Has anyone done something like this before and worked out what they thought was the best way to do this? Any ideas?
03-10-2010 04:39 PM
Hey All,
To add some input to this discussion, when the TCP connection is closed spontaneously, the Get File vi will throw an error. This error can be removed from the error line coming from the Get File vi which you can unbundle to get the boolean "Status" variable.
This method of parcing out an error to stop a process is also used with the Unqueue Element VI in the Producer/Consumer Loop template. When there are no more elements left in the queue to be read, the Unqueu Element VI throws an error which is used to stop the Consumer Loop.
Logan H