解决UDP无法跨网段时的控制器搜索问题
思路:
- 配置已知的搜索指令
- 配置已知的待搜索网段
- 定时使用HTTP发送指令至IP,收集并缓存收到的应答
- 监听收到UDP搜索指令,将未超时的缓存作为应答返回
?
配置
@@@code
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"Scan": {
"Minute": 60,
"AliveMinute": 720,
"Command": [
{
"Name": 1994,
"Enable": 1,
"Data": "19 94 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
"ProtocolHead": "1994",
"SNPosition": 4
},
{
"Name": 2410,
"Enable": 1,
"Data": "24 10 f4 33 02 06 00 00 00 00 00 00 ff ff ff ff 00 00 02 00",
"ProtocolHead": "2411",
"SNPosition": 8
?
},
{
"Name": 2440,
"Enable": 1,
"Data": "24 40 b3 e4 01 00 00 00 00 00 00 00 ff ff ff ff 00 81 02 00",
"ProtocolHead": "2441",
"SNPosition": 8
?
}
],
"Timeout": 3,
"NetMask": [
"172.16.2.*:60000",
"172.16.3.*:60000",
"172.16.4.*:60000",
"172.16.5.*:60000",
"192.168.153.*:60000",
"192.168.156.*:60000"
]
},
"UDPServer": {
"ProtocolHead": [
{
"Name": 1994,
"Heads": [ "1994", "1794" ]
},
{
"Name": 2410,
"Heads": [ "2410" ]
},
{
"Name": 2440,
"Heads": [ "2440" ]
}
],
"Timeout": 3,
"IPEndPoint": "127.0.0.1:60000"
},
"AllowedHosts": "*"
}
?
?
@@#
效果图
?
?
原文地址:https://www.cnblogs.com/QinQouShui/p/11493401.html