我的节点红色流包含一个带有我计算机IP地址的udp-out节点。但这种情况会不时发生变化,因此我需要手动更改它。如果要使用msg.ip进行设置,UDP输出节点的工具提示会将地址留空。
如何使用msg.ip?我还没有找到解决方案。它一直报告未设置udp地址。
答案 0 :(得分:0)
您在节点的配置对话框中将其留空,然后在您要通过节点发送的每条消息上,您需要将msg.ip
设置为您要将消息发送到的IP地址。
以下流程演示了:
[{"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"]]}]
它假设您从流程中的其他来源设置flow.ip
和flow.port
。