LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing IP Adress and port to .NET dll (system Uri)

Highlighted

Hi all,

I have been given a dll (written in .NET) from a company so that we can talk to their instrument remotely.

The first thing required is to connect to their PC by passing the IP address and port number (Company document says... 'The Open command needs a URI that contains not only the ip address but also port and service you want to access') but I am not sure how to do this.

I thought maybe I could use either the TCP or UDP pallet that has functions to input IP address and port and then convert to .NET using To .NET Object.vi but this outputs System.Object and the .NET input requires System.Uri. (see attached picture).

Can anyone help?

 

Chris

 

0 Kudos
Message 1 of 3
(293 Views)
Highlighted

Place a .Net Constructor Node on the diagram. In the dialog that opens go to "System (4.0.0.0)" or another higher version if you have that. In the list of object groups select "System" to expand that. In there search for "Uri" in the Objects list and select that. Underneath in the Constructors list you can select different methods. Most likely you just want the one which initialzes the Uri object with a single string address, so select the Uri(String uriString) constructor.

 

Now you can wire a string to that input such as "http://www.example.com:12345" and that will initialize the Uri object accordingly. 

Rolf Kalbermatter
Averna BV
0 Kudos
Message 2 of 3
(246 Views)
Highlighted

Thanks

That now connects to the Remote PC invoke node but the dll now errors. I guess I need to talk to the guy who wrote the dll now

0 Kudos
Message 3 of 3
(180 Views)