09-28-2022 02:22 PM
I have an NCD IO relay board that broadcasts some identifying information at 10 second intervals. I am simply trying to read this message with a labview VI. I have a snippet of a wireshark capture that shows all the source/destination/port information; and have attached a basic vi that I have been using to try to read this broadcast. The VI has 4 different versions of a 'read' UDP sequence. The best result I have achieved so far is for all 4 iterations to time out. Does anyone have any suggestions for what I have done wrong?
Solved! Go to Solution.
09-28-2022 02:46 PM
Hi Charles,
@CharlesD3 wrote:
The VI has 4 different versions of a 'read' UDP sequence.
What's their difference? From a first glance I can only distinguish 2 different versions…
09-28-2022 03:11 PM
So I guess the variable values may not have transferred with the file, but when operating the first two are different in that I can set each one to use a different port. The next two are also 'programmatically' the same, but operationally I can set them to different values when running. It is just a way to try multiple options when running.
09-28-2022 03:39 PM
All you need is listen on port 13000 and local address 255.255.255.255. Open before the loop, keep reading inside the loop, ignore timeout errors, and parse the output do your liking. Close UDP after the loop.
(You definitely don't what to open and close UDP connections as fast as the computer allows. the port from the previous iteration might still be reserved when you try to open a new one a nanosecond later.)
Here's a quick draft:
(Still needs adjustments, e.g. use a shift register for the error wire and clear timeout errors. Stop the loop on any other errors. decide on a reasonable timeout, etc.
09-29-2022 07:13 AM
Unfortunately, this code gives me an error 54, 'The network address is ill-formed'. I tried several variations; display formats, representations, etc. All get the same error. The only way I've managed to not get an error with the 'open' function is when I use a string and the 'string to ip' function or leave the 'net address' unwired; like in the file I submitted. That does not generate an error, but does not work.
09-29-2022 07:51 AM
I think the net address input should be left unwired. Are you sure that the packet is not dropped by a firewall?
09-29-2022 10:34 AM - edited 09-29-2022 10:36 AM
@CharlesD3 wrote:
Unfortunately, this code gives me an error 54, 'The network address is ill-formed'. I tried several variations; display formats, representations, etc. All get the same error. The only way I've managed to not get an error with the 'open' function is when I use a string and the 'string to ip' function or leave the 'net address' unwired; like in the file I submitted. That does not generate an error, but does not work.
Display format is irrelevant for the data. A network address is U32. Unless you show us what you actually did (or tried), we cannot help.
I don't get error 54 (or any other error!) when I run the following code:
This is on Windows. On Mac, linux, etc the behavior is slightly different, so check the help.
09-29-2022 11:01 AM
So one other tidbit that may be relevant: I am running 2019 SP1, 64 bit.
The error on probe 30 is code 1: 'an input parameter is invalid'; presumably because of the error generated at the 'open' command.
09-29-2022 11:38 AM - edited 09-29-2022 11:42 AM
You already get an error on probe #32, so let's focus on that first and worry about the downstream issues later.
Attach your latest VI!!!
Also provide more information on your setup.
09-29-2022 11:57 AM - edited 09-29-2022 11:59 AM
Can you try this code? (Yes, just listen on the default local address. It will see broadcasts)