问题描述:

My node-red flow includes an udp-out node with my computer's ip address. But this changes from time to time, so then I manually need to change it. The tooltip for the UDP-out node says to leave the address blank if you want to use msg.ip to set.

How do I use msg.ip? I haven't find a solution to this. It keeps reporting udp address not set.

网友答案:

You leave it blank in the config dialog for the node, then on EVERY message you want to send out via the node you need to set msg.ip to the ip address you want to send the message to.

The following flow demonstrates:

[{"id":"238e2695.98a252","type":"udp out","z":"59370ac1.51144c","name":"","addr":"","iface":"","port":"","ipv":"udp4","outport":"","base64":false,"multicast":"false","x":547.5,"y":181,"wires":[]},{"id":"2a002216.f8cb3e","type":"inject","z":"59370ac1.51144c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":141.5,"y":180,"wires":[["6d51ce96.66603"]]},{"id":"6d51ce96.66603","type":"change","z":"59370ac1.51144c","name":"","rules":[{"t":"set","p":"ip","pt":"msg","to":"ip","tot":"flow"},{"t":"set","p":"port","pt":"msg","to":"port","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":353.5,"y":180,"wires":[["238e2695.98a252"]]}]

It assumes you set the flow.ip and flow.port from some other source in the flow.

相关阅读:
Top