Tcp In to Tcp Out not working.

495 views
Skip to first unread message

Glendon Turner

unread,
Nov 18, 2016, 5:12:20 AM11/18/16
to Node-RED
I have created a very simple node-red flow with just a TCP IN node listening on a specific port, configured as output single string.
I also have a TCP OUT node, and set it as "Reply to TCP".
In addition I have a debug node showing the complete message object.
I have connected the TCP IN node to the TCP OUT and debug nodes and deployed.

I now have an Arduino (ESP8266) connecting to the TCP IN port and once it connects to the TCP IN Port, it sends a string. I can see the string appear in the debug area in node-red.
The ESP8266, after sending the string, waits for up to 5 seconds in a loop looking for any response on that same port.

The problem is that I never get a response back to my Arduino.

Is there a way I can test if my server (remotely located interstate in a datacenter) is sending the response?
Or does anyone else have any ideas? I have been searching for days without success.

Thanks

Dave C-J

unread,
Nov 18, 2016, 6:29:06 AM11/18/16
to node...@googlegroups.com
a) can you try sending from another device ?
b) can you split the flow to also send to another tcp port that you can point something like netcat (nc) or socat at ?

Glendon Turner

unread,
Nov 18, 2016, 9:06:22 PM11/18/16
to Node-RED
Hi Dave C-J,

Thank you for your response.
I am using OSX, and found a utility called Packet Sender. I have used this to send a string to the port I have assigned.
It too doesn't show anything being returned from Node-red.
I have confirmed the port is open to both input and output in WHM on my server.
I can see the incoming connection come & go in the node-red interface. I normally see 0 connections, and when I send a packet to it, it shows 1 connection for a brief time, then back to 0 connections again. This is as expected as I am not keeping the TCP connection open (not persistent).

When I send the packet, I get three lines in the log.
First line shows me;
From IP (my IP)
From Port (63168)
To IP (my servers static IP)
To Port (19691) which is the port I am trying to use.
Method (TCP)
Error (blank)
ASCII (the string I am sending)

The second line show me;
From IP (my servers static IP)
From Port (19691)
To IP (My IP address)
To Port (63168)
Method (TCP)
Error (blank)
ASCII (blank)

The third line I see is almost identical to the second with a slightly later timestamp (approx 300mS).

Each time I send the packet, the from port (my pc) and the to port (response, lines 2 & 3) changes

I have tried deleting the TCP out node and recreating it without any change in operation.

Glendon Turner

unread,
Nov 18, 2016, 9:14:59 PM11/18/16
to Node-RED
I have just created a new tcp-out node with a different port and "listen on" selected and wired to the output from my initial TCP in node.
I can create a persistent TCP connection from Packet Sender to this new port, and then I can send a string to the original port and I see it being returned to the new port.

This shows that node-red is replying to the new port (but it is essentially a TCP server), but still not responding to the original port.



On Friday, November 18, 2016 at 8:12:20 PM UTC+10, Glendon Turner wrote:
Reply all
Reply to author
Forward
0 new messages