LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET http/https asynchronously get a document

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

 

sync client.png

async client.png

0 Kudos
Message 1 of 5
(2,518 Views)

Would be glad if somebody can point me in the right direction...

0 Kudos
Message 2 of 5
(2,476 Views)

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?

0 Kudos
Message 3 of 5
(2,468 Views)

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.

0 Kudos
Message 4 of 5
(2,462 Views)

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.

0 Kudos
Message 5 of 5
(2,440 Views)