11-24-2021 08:59 AM
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.
11-24-2021 09:01 AM
If I run this NETSH command line, I get what I want. It's looking ONLY for the "Ethernet" kind:
However, running that same exact command thru LabVIEW's EXEC process fails (syntax error - it doesn't like the pipe character).
Blog for (mostly LabVIEW) programmers: Tips And Tricks
11-24-2021 09:06 AM
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.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
11-24-2021 09:10 AM - edited 11-24-2021 09:10 AM
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.
11-24-2021 09:12 AM
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.
11-24-2021 09:13 AM
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....
Blog for (mostly LabVIEW) programmers: Tips And Tricks
11-24-2021 09:15 AM
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
11-24-2021 09:32 AM - edited 11-24-2021 09:32 AM
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.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
11-24-2021 09:45 AM
@CoastalMaineBird wrote:
If I run this NETSH command line, I get what I want. It's looking ONLY for the "Ethernet" kind:
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
11-24-2021 12:10 PM
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.