● 海康威视摄像设备局域网发现原理
公司有3部海康摄像头,1台海康硬盘录像机。
因为想知道SADP搜索软件是如何发现设备的,所以我查了下资料:
SADP搜索软件是向239.255.255.250:37020发送udp消息(soap.udp://239.255.255.250:37020)以达到局域网广播目的。
组播地址:239.255.255.250是SSDP(简单服务发现协议),这是路由器的UPNP服务使用的协议。
wireshark抓包获取传输数据
软件客户端发起搜索:
<?xml version="1.0" encoding="utf-8"?>
<Probe>
<Uuid>F93CF8DC-DF53-424B-98A7-9FC0536E1083</Uuid>
<Types>inquiry</Types>
</Probe>
摄像头回应:
<?xml version="1.0" encoding="UTF-8"?>
<ProbeMatch><Uuid>F93CF8DC-DF53-424B-98A7-9FC0536E1083</Uuid>
<Types>inquiry</Types>
<DeviceType>140071</DeviceType>
<DeviceDescription>DS-2CD5026EFWD-A</DeviceDescription>
<DeviceSN>DS-2CD5026EFWD-A20171214AACH147955970</DeviceSN>
<CommandPort>8000</CommandPort>
<HttpPort>80</HttpPort>
<MAC>64-db-8b-08-cf-45</MAC>
<IPv4Address>192.168.66.25</IPv4Address>
<IPv4SubnetMask>255.255.255.0</IPv4SubnetMask>
<IPv4Gateway>192.168.66.254</IPv4Gateway>
<IPv6Address>::</IPv6Address>
<IPv6Gateway>::</IPv6Gateway>
<IPv6MaskLen>64</IPv6MaskLen>
<DHCP>false</DHCP>
<AnalogChannelNum>0</AnalogChannelNum>
<DigitalChannelNum>1</DigitalChannelNum>
<SoftwareVersion>V5.5.0build 170914</SoftwareVersion>
<DSPVersion>V7.3 build 170818</DSPVersion>
<BootTime>1970-02-10 05:19:22</BootTime>
<Encrypt>true</Encrypt>
<ResetAbility>false</ResetAbility>
<DiskNumber>0</DiskNumber>
<Activated>true</Activated>
<PasswordResetAbility>true</PasswordResetAbility>
<PasswordResetModeSecond>true</PasswordResetModeSecond>
<SupportSecurityQuestion>true</SupportSecurityQuestion>
<SupportHCPlatform>true</SupportHCPlatform>
<HCPlatformEnable>flase</HCPlatformEnable>
<IsModifyVerificationCode>true</IsModifyVerificationCode>
<Salt>21ea877fbac71d715a34f28e194d39b80ed9965e96e26bb0a6b00d6240e1dc3b</Salt>
<DeviceLock>true</DeviceLock>
</ProbeMatch>
根据这个原理,顺利搜索到局域网设备:
推荐一篇文章:《ONVIF、RTSP/RTP、FFMPEG的开发实录》