Setting up TCP Communication
- 04 Feb 2025
- Imprimir
- DF
Setting up TCP Communication
- Actualizado el 04 Feb 2025
- Imprimir
- DF
The content is currently unavailable in Spanish (Mexico). You are viewing the default English version.
Resumen del artículo
¿Te ha resultado útil este resumen?
Gracias por tus comentarios
The camera can use Node-RED to communicate with other devices over TCP.
Note
The camera's IP address must be in the same range as the device it is communicating with.
Navigate to the IO Block to configure the Node-RED logic.
A communication port (tcp in) must be opened, where we assign the port we want the camera to listen to.
To send a response to the port, we need to place a tcp out node, assign the IP address of the device we are communicating with, and assign a free port. Refer to the example below:
Node-RED Logic
[
{
"id": "85237e29b8e86d05",
"type": "tcp in",
"z": "c0ed903576d54694",
"name": "",
"server": "server",
"host": "",
"port": "49155",
"datamode": "stream",
"datatype": "utf8",
"newline": "",
"topic": "",
"trim": false,
"base64": false,
"tls": "",
"x": 780,
"y": 160,
"wires": [
[
"8aac7b8d6e607f2c"
]
]
},
{
"id": "f2652272e23aef9f",
"type": "inject",
"z": "c0ed903576d54694",
"name": "Part 1",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 160,
"wires": [
[
"a93161abf53cadef"
]
]
},
{
"id": "8d1350846af1f18b",
"type": "debug",
"z": "c0ed903576d54694",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 520,
"y": 160,
"wires": []
},
{
"id": "a93161abf53cadef",
"type": "function",
"z": "c0ed903576d54694",
"name": "function 1",
"func": "msg.payload = \"....\";\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 340,
"y": 160,
"wires": [
[
"8d1350846af1f18b",
"6c867cbe2ea47239"
]
]
},
{
"id": "6c867cbe2ea47239",
"type": "tcp out",
"z": "c0ed903576d54694",
"name": "",
"host": "192.168.0.100",
"port": "49255",
"beserver": "client",
"base64": false,
"end": false,
"tls": "",
"x": 570,
"y": 220,
"wires": []
},
{
"id": "8aac7b8d6e607f2c",
"type": "debug",
"z": "c0ed903576d54694",
"name": "debug 6",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 960,
"y": 200,
"wires": []
}
]
¿Fue útil este artículo?