LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to cancel FTP operation

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.

---------------------------------
[will work for kudos]
0 Kudos
Message 1 of 9
(7,390 Views)

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

Message 2 of 9
(7,377 Views)

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?

---------------------------------
[will work for kudos]
0 Kudos
Message 3 of 9
(7,358 Views)

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.



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
Message 4 of 9
(7,348 Views)
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?
---------------------------------
[will work for kudos]
0 Kudos
Message 5 of 9
(7,338 Views)
shared variables, a queue, a notifier, a reference to a front panel control so that you can read the Value property node, action enginer aka functional global variable, a regular global variable.
Message Edited by Ravens Fan on 03-10-2010 03:19 PM
Message 6 of 9
(7,333 Views)

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.

Message Edited by Mark Yedinak on 03-10-2010 02:58 PM


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
Message 7 of 9
(7,328 Views)

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?

---------------------------------
[will work for kudos]
0 Kudos
Message 8 of 9
(7,317 Views)

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

National Instruments
Applications Engineer
Message 9 of 9
(7,311 Views)