设置 TCP 通信
- 27 Jan 2025
- 打印
- PDF
设置 TCP 通信
- 更新于 27 Jan 2025
- 打印
- PDF
文章摘要
您觉得此摘要对您有帮助吗?
感谢您的反馈
摄像机可以使用 Node-RED 通过 TCP 与其他设备进行通信。
注意
摄像机的 IP 地址必须与其通信设备处于同一地址范围内。
进入 IO Block 配置 Node-RED 逻辑。
必须打开一个通信端口(tcp in),并指定摄像机监听的端口。
若要向端口发送响应,需要放置一个tcp out节点,指定通信设备的 IP 地址,并分配一个空闲端口。请参考以下示例:
Node-RED 逻辑
[
{
"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": []
}
]
本文对您有帮助吗?