TCP Host Address via msg.payload?

#1

We are using a TCP node and that is working well.
However , the TCP Host address will be changing based on user setup.
Looking for method to have user enter the Host IP address in Dash board and pass that into the TCP node as IP address. But not having much luck.

Any ideas?

#2

Hi. The TCP Out node doesn't allow the host to be set dynamically. It has to be hardcoded in the node.

#3

Hi Nick,
First of all , NODE RED is incredible tool!
-TCP IP address needs to be 'hardcoded' into the node- OK, I am sure there is some good reason for this.

But it sure would be nice, since we want to avoid 'end-users/ operators' from entering into the "FLOW" to enter/change the IP. Just in case they accidentally delete / alter the other parts of the flows.

#4

Sorry, I missed a vital piece of information in my original reply... whilst the TCP In/Out nodes are for long-held connections, the tcp-request node does let you set host/port dynamically.

#5

Hi Nick,
I am trying the TCP Request node.
Added an INJECT node (for testing) with the IP address that we want to set the TCP to. But still not connecting.
WHat is the proper way to 'inject' in the IP address as User Defined ( not hardcoded)

#6

The sidebar help for that node tells you how to do it. Hint - you leave the necessary fields blank and set the appropriate message properties.

#7

Thank you Nick! I found it.
For sake of others in the community.
Setting the IP address for a TCP node can be done 'dynamically' ( from user input field)

  1. Use the TCP Request node ( not the TCP output node)
  2. Leave the TCP Request node field blank
  3. Inject the msg.host and msg.port to the TCP Request node with the desired.