Read TCP message

Hi,
I implemented this flow in Node-red installed on a NUC at 192.168.1.15:1880 and am trying to test from a PC windows with the command "net send 192.168.1.15:3000 test" or net send 192.168. 1.15:3001 test but I don't get anything back in the debug.
I don't know if it's the flow that doesn't work or the way to send the message with windows.

(The final objective will be to recover an action on the IP videophone in button but I start by testing the flow with a PC, otherwise I have to move to the street videophone for each test!)

[
    {
        "id": "c0a1fd31b8520c67",
        "type": "tab",
        "label": "Flux 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "2ebb0c81e2cb08c4",
        "type": "debug",
        "z": "c0a1fd31b8520c67",
        "name": "debug 2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 560,
        "y": 240,
        "wires": []
    },
    {
        "id": "62ee2f28e44bcc77",
        "type": "node-red-contrib-http-custom-port",
        "z": "c0a1fd31b8520c67",
        "name": "test",
        "url": "/192.168.1.101",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "port": "3001",
        "x": 330,
        "y": 240,
        "wires": [
            [
                "2ebb0c81e2cb08c4"
            ]
        ]
    },
    {
        "id": "ef432e3f1a0f275e",
        "type": "tcp in",
        "z": "c0a1fd31b8520c67",
        "name": "",
        "server": "server",
        "host": "",
        "port": "3000",
        "datamode": "stream",
        "datatype": "utf8",
        "newline": "\\n",
        "topic": "",
        "trim": false,
        "base64": false,
        "tls": "",
        "x": 540,
        "y": 380,
        "wires": [
            [
                "825896b40c7c96b9",
                "d24c5bbd4d73d2af"
            ]
        ]
    },
    {
        "id": "825896b40c7c96b9",
        "type": "debug",
        "z": "c0a1fd31b8520c67",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 680,
        "y": 420,
        "wires": []
    },
    {
        "id": "d24c5bbd4d73d2af",
        "type": "tcp out",
        "z": "c0a1fd31b8520c67",
        "name": "",
        "host": "",
        "port": "",
        "beserver": "reply",
        "base64": false,
        "end": false,
        "tls": "",
        "x": 800,
        "y": 380,
        "wires": []
    }
]

Firewall on the NUC?

Are you sure the "net send" -command works like this?
I wanted to try it but I found out that since Windows 7 the "send" option of the net command is removed.(i.e last seen on XP :exploding_head:
It is apparently replaced by the "msg" command, but that wont accept the syntax you use eg.:

msg 192.168.1.15:3000 test

does not work instead of

net send 192.168.1.15:3000 test

thanks for the feedback.
I just reread the windows documentation and the msg command is not available for the home edition of windows 10/11.
How would I go about testing my flow? (I also have a NUC with Ubuntu installed but I'm not familiar with Linux commands)

You have set my last comment as the solution for this thread?
I don't think it counts as any kind of solution :wink:

First you could do a purely local test on your Node Red instance like this:
image

[{"id":"b8ef182c5e71e433","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"a5e5238c2a2335cd","type":"inject","z":"b8ef182c5e71e433","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":315,"y":300,"wires":[["5cd4df52dd938fb3"]],"l":false},{"id":"cd3579425b257a65","type":"debug","z":"b8ef182c5e71e433","name":"debug 17","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":765,"y":300,"wires":[],"l":false},{"id":"8c20bfcaf41f37bd","type":"tcp in","z":"b8ef182c5e71e433","name":"","server":"server","host":"","port":"3000","datamode":"stream","datatype":"utf8","newline":"","topic":"","trim":false,"base64":false,"tls":"","x":640,"y":300,"wires":[["cd3579425b257a65"]]},{"id":"5cd4df52dd938fb3","type":"tcp out","z":"b8ef182c5e71e433","name":"","host":"localhost","port":"3000","beserver":"client","base64":false,"end":false,"tls":"","x":460,"y":300,"wires":[]}]

I noticed you have set "\n" "newline" as "delimited by" in your TCP-in node. It will then only forward messages if you data is in fact delimited by "\n".
Please note this test will probably not show/catch problems regarding a firewall i.e. it will work even if there is a firewall which is blocking port 3000.

If above works (most probably it will :face_with_peeking_eye:) you should next try from a remote machine. If you are mostly familiar with Windows I would suggest to use a terminal program like RealTerm or YAT, or any other terminal program that can connect using TCP sockets. Also on this remote client machine you must make sure there is no firewall blocking outgoing connections.

I didn't check the solution box?

I imported your feed which works but I'm lost in YAT. I configured the terminal by selecting the Ethernet card from my PC but then I cannot find where to put the address of the NUC where node-Red is installed
(It's not better with Auto Socket)

Hmm, strange with the solution box...

Anyways, you must select TCP-client in YAT:
image

:+1: it works ! Thanks a lot for the help.
I now have to send the information with my videophone (Mobotix) but now knowing that on the Node-Red side it is operational.

I changed the current_state node load but I got an error

Your "TCP-problem" is solved so it may be that your next question should have been asked in a new thread.
Maybe one of the friendly admins here will split the thread?

First as directly seen from the error message, you must somehow populate the "Entity ID" in the Home Assistant node.
image
I suppose it must be populated with an existing ID in your Home Assistant.

Second. As far as I understand you, you are going to send some information from a device (IP Videophone) via TCP into Node Red and then into Home Assistant? Then this node is not the right one. As far as I understand it is for querying states of entities from Home Assistant.

Following the NR error message, I created an input_text entity in home assistant and modified the node parameters but I still got an error.

Indeed, I would ultimately like, following the action of the Mobotix bell button, to trigger a Home-Assistant automation to send a message into a Sonos speaker.

[Edit]
I found the node to use and my value was successfully transmitted to HA.
Thanks again for the help!

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