06-21-2012 11:16 AM
Hi all,
I want to retrieve a file from the internet using http(s) with a .NET based client in LabVIEW. I have already a synchronous client (something similar to this thread, see attachment) which works well over http and https. It is based on the WebRequest class.
Now I want to change it to an asynchronous client so I can abort a request, that's not possible with the synchronous client it continues until time-out. I don't have experience with .NET neither with classes in LabVIEW, but I found a description how to create a client which fulfills my needs on MSDN, I can understand most of it and want to create something similar in LabVIEW.
There is another, two years old, thread on this topic, link.
Problem is I get a bit lost in all events, callbacks, and so on which need to be created in a certain order and have to be linked via refnums and so on. See attached image.
Anybody which can point me in the right direction, or willing to share an implementation?
Using LabVIEW 2010 SP1.
Regards, Biggeveen
06-25-2012 02:11 AM
Would be glad if somebody can point me in the right direction...
06-25-2012 08:08 AM
It's not really clear to me what you are asking about. Are you asking about how to use .NET callbacks? Are you asking about how to do .NET programming in LabVIEW? Or are you asking about the specific example from MSDN that you pointed to?
06-25-2012 03:58 PM
Well smercurio_fc, IF I would know how to use callbacks and callback VIs this would help a lot... Thanks for pointing me to that.
That MSDN example was merely referenced to see how the various .NET parts should operate with each other.
Some basic .NET programming from LabVIEW I know.
Just found there's a NI community on LabVIEW and .NET about callbacks, events and so on, I will take a look at that.
06-29-2012 10:30 AM
It seems you cannot use the WebRequest class in an asynchronous way because this .NET class doesn't generate events, so you cannot register for them in LabVIEW and cannot fire callback VIs on those events.
Compare WebClient with WebRequest and note the section Events is missing on the left at the WebRequest class.
With the WebClient class (upper class of WebRequest) it seems possible, because this class does generate events.