Hi everybody.
I'm using a "TCP Request" node to retrieve data from a PV monitoring system, polling it every 30 secs, but I'm struggling to get it to work correctly.
Issue:
the TCP node will not disconnect or will stop sending out requests; I've tried a couple approaches which all failed in the end.
-
TCP node set to automatically disconnect after "xx ms"
Issue seen previously here: the setup works fine for a couple minutes until - I suppose - the remote device does not return any response; the connection is not terminated and the status stays "connected" with the green dot. When this happens new connection requests are rejected/have no effects and I need to deploy the node again to resume functionality. -
TCP node set to keep connection open
This is a solution proposed here: the TCP node should keep the connection open, letting me close it by sending in a wrong port number 2 seconds after the first connection. Again, this works for some times (uhm some hour I'd say) until the TCP node does not connect anymore. I've no idea why this should happen: it receives incoming messages and correctly displays errors when the wrong port is set, but does not attempt a TCP connection nor returns any data.
What I would ideally accomplish is straight forward: send a message to the TCP node, have it return data OR an error if the remote device is not available, close the connection EVEN IF no data has been received by the node, then repeat.
From the first post linked seems like the issue with the TCP node not returning in the first place is that a timeout is set only from when data is received... is there a way to kill the connection anyways? My second approach was trying to address this issue but it's not working.
I've read somebody suggesting to use only TCP in/out nodes: I cannot, should be able to set the in/out port to receive the data back.
Partially a duplicate of the first linked post, but the problem is still here after a year, thought it might be worth pointing out.
Thanks! Cheers
Info: NodeRED v-1.0.6