LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV + RPi 4B Wifi Network Communication Issue

Hi, I've run into an issue communicating with a Raspberry Pi 4 over wifi using TCP/UDP through LabVIEW.  I've run this on my own home network as proof of concept successfully, however, when switching to another wifi network on a different router, I encounter partial communication problems.  The successful setup (Asus RT-AC68U router, connected to internet) is as follows:

 

- Standalone exe running on PC (LV2020, Win10) listens for UDP packets on group IP/port

- Startup rt exe running on RPi broadcasts name/IP as acquired from IP-to-String function (both dot and non-dot strings)

- PC gets UDP packet (receives string "[name] [IP]"), makes TCP connection to RPi at [server IP]

- PC and RPi can send packets back and forth over TCP

 

The unsuccessful setup (Asus RT-ACRH17, not connected to internet) is as follows:

 

- Standalone exe running on PC (LV2020, Win10) listens for UDP packets on group IP/port

- Startup rt exe running on RPi broadcasts name/IP as acquired from IP-to-String function (both dot and non-dot strings)

- PC gets UDP packet (receives string "[IP] [IP]"), attempts to make connection over TCP but cannot.

 

The main difference in behavior that I can tell without trying to dig into remote panels is that the RPi cannot resolve its name using IP-to-String, which I figure is symptomatic of the other communications issues I'm encountering, and the only variable is the router to which the PC and RPi are connected.  There are no error terminals coming out of the IP-to-String function so I'm not sure I can even find an error related to getting the device name.  I've tried synchronizing any settings between the routers, but no help, still the difference is that one router is online and one is not.  The intent is to keep the dedicated router offline altogether and just provide wireless communication between the PC and RPi devices.  Is there something I'm overlooking in the router setup or capabilities that is preventing the RPi from getting its name from IP-to-String?

0 Kudos
Message 1 of 4
(932 Views)

You need a DNS server in order for the even remotely hope to be able to resolve an IP address to a hostname. Unless your router has such a facility, it will simply forward the according requests to its registered DNS server that it received during connection build up with the internet. Without internet there is no place to forward the DNS request and it will simply be dropped, which eventually will result for the IP to hostname function called in the LabVIEW node to timeout and return with an empty string.

 

But I have an important question about your router. Is this an ADSL router or something that uses NAT to translate private IP addresses to public addresses on the internet. If sou your private addresses on the internal network are hardly translatable through DNS, although there are some efforts such as mDNS and zeroconf to provide that anyways. The result is however causing more trouble than it solves so far, so it is not a very good idea to rely on that functionality. For such networks my standard approach is always to use explicit IP addressing and refrain from nice looking hostname addressing that may or may not work depending on the climate and current moon phase. 😁

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 4
(866 Views)

Hi, I'm not sure that a DNS server is required for what I'm doing.  I'm able to take my development computer, hook it up with an ethernet cable to the unsuccessful router (not connected to the internet), and running IP-to-String with no dot notation gives me the name of the PC (DESKTOP-*******).  I can also log into the router when not connected to the internet and see the client name and corresponding IP address.  The problem seems to be with the RPi trying to get its own name from IP-to-String in the same way, and this is symptomatic of a deeper problem effecting the ability to connect properly.  I use the IP of the device to connect, but I get weird behavior trying to do so over this router.  When running IP-to-String from code deployed to the RPi on the unsuccessful router, using multi output option on String-to-IP, I can get "localhost" and the IP, but not the name ("raspberrypi").  Since the router can find the name of the device connected to it, and the PC can get its own name, I figure the RPi should be able to do the same with IP-to-String.

0 Kudos
Message 3 of 4
(842 Views)

Lot's of assuming here :-). In reality this is part of the mDNS, zeroconf and Windows PnP  infrastructure, which in absence of a real DNS service, tries to do some local resource discovery and management. And just because it works on your Windows computer does not mean that it will work on your Raspi. There is a lot of proper local configuration involved to make these services work correctly despite names such as zeroconf. Also even under Windows it barely works, depending what you want to do. And since this is not a shared infrastructure each device needs to get it all right in itself before it can work on it.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 4
(834 Views)