LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

STR to IP --- Which result?

Who is the administrator of the computer where the software is running? Is it possible that someone comes along and changes stuff in the computer? Is is possible that someone changes the network interface card?

 

If nobody can mess around with the network names, then the command I linked above will be enough. If you cannot guarantee this, but the physical hardware stays the same, you can filter by MAC addresses.

0 Kudos
Message 11 of 23
(2,583 Views)

If I run this NETSH command line, I get what I want.  It's looking ONLY for the "Ethernet" kind:

 

IPaddr.png

However, running that same exact command thru LabVIEW's EXEC process fails (syntax error - it doesn't like the pipe character).

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 12 of 23
(2,581 Views)

Who is the administrator of the computer where the software is running? Is it possible that someone comes along and changes stuff in the computer? Is is possible that someone changes the network interface card?

 

All of that is out of my control.  It's for my customer, and I don't want to impose any requirements.  This is strictly informational: i.e., "Set your gizmo to send data to 192.168.1.30 and my program will receive it". The user can find it via other means, I was hoping to present it front and center.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 13 of 23
(2,579 Views)

I've found that with every new Windows update, you run the risk of Windows re-enumerating your network interfaces and maybe even adding some virtual ones, so this is a really tricky situation.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 14 of 23
(2,576 Views)

Maybe you can try to look with this library if you can find the necessary adapters by looking at the various values for each returned network adapter. If this doesn't help I'm out of options for the moment.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 15 of 23
(2,572 Views)

you run the risk of Windows re-enumerating your network interfaces

 

That's why I'm suspicious of relying on the order of things returned.

 

If I look for "Ethernet", it will disregard the virtual interfaces.  Of course if they have two NIC cards....

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 16 of 23
(2,571 Views)

Maybe I wasn't clear.  You have a "Remote Device" that wants to connect to a specific "Host", and the goal is to have a LabVIEW routine running on some other (I presume) "Program Host" (here meaning the PC-on-the-network that will actually use the Remote Device).  What you are looking for is something that you can program into the Remote Device to tell it the IP of the Host to which it should connect.

 

Can you not set up the Remote Device to be a "listener" for an incoming TCP "Request to Connect", as opposed to an "initiator" for such a Request?  I've had two kinds of experiences with Hosts and Remote Devices -- one where there were physical devices out there (I'm thinking of a series of IP Cameras that had static IPs that were originally "hand-wired" into MAX, but subsequently configured programmatically by LabVIEW from an Excel (I think) worksheet output of the manufacturer's utility that found all "reachable Basler cameras" on the network, and a set of Mettler balances that were connected to a pair of "Serial-to-TCP/IP" boxes that allowed "VISA over TCP/IP"), and the other LabVIEW Real-Time systems where we needed to establish communication with a specific Target and establish a Network Streams communication path.

 

In both cases, the Remote Device had a defined IP, and played a "passive role" until the connection was established by the Host, either "knowing" the IP (I don't right now recall how we did this for the Cameras and Balances), or querying at Run Time for Real-Time Remote systems, where there is only a single IP per remote device, namely the IP that the Device uses to "listen" on the Network for incoming traffic.  The Remote Device should already be on the Network (or, if it is not, then your Program won't be able to run, will it?), and should only present a single address.

 

Bob Schor

0 Kudos
Message 17 of 23
(2,568 Views)

What you are looking for is something that you can program into the Remote Device to tell it the IP of the Host to which it should connect.

 

Not exactly.  The remote device is something I have no control over.  There is some type of UI to configure it to connect to address X.X.X.X and send its data (UDP or TCP).  I simply want to display, on the Windows host program (which I develop), the address that I'm listening on.  They then enter that address into the gizmo, and away we go.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 18 of 23
(2,561 Views)

@CoastalMaineBird wrote:

If I run this NETSH command line, I get what I want.  It's looking ONLY for the "Ethernet" kind:

 

IPaddr.png

However, running that same exact command thru LabVIEW's EXEC process fails (syntax error - it doesn't like the pipe character).


Try

cmd /c netsh interface ip show config name="Ethernet" |findstr "IP-Adress"

as input for System Exec.vi

Message 19 of 23
(2,554 Views)

I found a problem with the library I posted about earlier.

Also added a function to retrieve the currently active network "adapters" and their IP address.

LLB should be in LabVIEW 2009 format.

 

 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 20 of 23
(2,527 Views)