TCP Duplex Communication

I have search far and wide and every where i see people asking a similar question and the people answering the fail to understand the problem.

the problem!

I have an inject node that must write msg.payload="Hello World" when pressed.
I have a debug node that display msg.payload.
I have putty that can make a TCP connection to node red.

lets choose a TCP port 7000 for this example

please set up node red so that PUTTY can connect to TCP Port 7000

then Wire the inject node to the TCP connection so that when I press the Inject, the text appear in PUTTY over the TCP Connection Port 7000 AND wire the debug node to the TCP connection so that when I typed text in PUTTY it will appear in the debug node in node red

Can someone please show me how?

thanks

How much of that have you managed to get working?
Export and paste here the flow showing what you have done so far.

Further to that, do you mean that you want node-red to have a port open ready to receive an incoming TCP connection from a putty client, but you want node-red to send something before the remote client has made its first connection? I cannot see how that can be possible, the client has to make the connection first.

Yes I want to run node red first. Then I want to start putty and tell putty to TCP connect to Port 7000
on local host (127.0.0.1). So node red should be ready to accept the connection. (Putty and node red run on the same machine)

No node red does not / can not send something before putty has connected.

once putty made the connection i want to press the inject node and the text must appear in putty.
then i want to type in putty and the debug node must display what i have typed.

Thanks

The TCP ports don't handle ssh - (which is by default what putty uses) - as there is a logon handshake that occurs... - If you use a raw TCP connection (eg nc or socat) then a simple back to back will do the basics

[{"id":"27fd830ddc02c1ee","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"d1df722b30636058","type":"tcp in","z":"27fd830ddc02c1ee","name":"","server":"server","host":"","port":"7777","datamode":"stream","datatype":"buffer","newline":"","topic":"","trim":false,"base64":false,"tls":"","x":215,"y":240,"wires":[["4a8fd296423baf53"]]},{"id":"4a8fd296423baf53","type":"tcp out","z":"27fd830ddc02c1ee","name":"","host":"","port":"","beserver":"reply","base64":false,"end":false,"tls":"","x":490,"y":330,"wires":[]},{"id":"fc1f4b448e72c256","type":"inject","z":"27fd830ddc02c1ee","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello","payloadType":"str","x":235,"y":375,"wires":[["4a8fd296423baf53"]]}]


give

$ nc localhost 7777
Hello

I've not got putty to hand but maybe you can try this - raw mode -
Using PuTTY.

Yes PUTTY has a RAW mode not SSH. That is what I use.
No Your TCP to TCP is not what I want. How do I send data from your tcp node back to your tcp:7777 node?

I have played with all the configurations of TCP in and TCP out and TCP response.

TCP is by design duplex, meaning I can send and receive data.

This is step one of my problem. I can connect to the TCP Out node on Port 7000 and when I press the Hello World inject node I receive data on PUTTY

But when I type in PUTTY I get nothing Back

I'm not sure what you mean then... the in node is for data from your putty session. the hello is the inject you want to send back. You can intercept the data from the in node and do whatever you like with it ...


but in my case I just echo'd it straight back...
(the "out" node is set in reply-to mode)


Here is the closest I get to my solution.
BUT I have to Run 2 PUTTY instances, I want to run 1. I want to send data to putty and then be able to reply with that same PUTTY instance

I think your issue is you are running putty on the same machine and the tcp in node would be listening on same port and ip as putty, try running putty on a differnt machine/ip.

err - the OUT node MUST be set to reply to mode - so that the IN node is the one that binds and then the reply uses that same... works just fine (using nc) with the flow I posted originally (and indeed without the feedback wire)
image

Thanks!! it is working

I have been all over the settings

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.