08-02-2022
02:53 PM
- last edited on
11-06-2024
03:20 PM
by
Content Cleaner
I found some weird verbiage in the UDP Open documentation:
| net address specifies on which network address to listen. Specifying an address is useful if you have more than one network card, such as two Ethernet cards, and want to listen only on the card with the specified address. If you do not specify a network address, LabVIEW listens on all network addresses. This function broadcasts only on the default network address. Use the String To IP function to obtain the IP network address of the current computer. (VxWorks) You cannot send a broadcast from a network card on a target that runs VxWorks and receive the broadcast on that same network card. (Linux, Mac, VxWorks) If you wire this terminal, you cannot receive broadcasts. |
For most subVIs, if a terminal is not required and not wired, it runs with default data. In this case, if I right click on that terminal and select "create constant", it creates a U32 control with a default of 0. But from the verbiage, it sounds like running with that default 0 isn't the same (for example, you'd only listen on the card with address 0) so if I wanted to switch between the "unwired" setting (listen to all) and the wired setting, I'd have to wrap that function with a case structure and leave one of the cases unwired? Is there a cleaner way to get the unwired behavior? How common is it for nodes to behave differently unwired vs wired with defaults?
08-02-2022 04:39 PM
I’m not sure about this specific case but a net address of 0 is the opposite of the broadcast address. LabVIEW certainly has the ability to detect if a terminal is wired or not and in many cases uses in that case a canonical internal value that is NOT always the default data value for that terminal. For instance some network functions will consider an unconnected network address string to be equivalent to localhost, which is not the same as the empty string constant value. So I would take that text pretty serious and only start to look further if I have reason to believe that it works actually different.