如何检查单个IP地址以了解它是否是IP摄像机地址

时间:2014-01-09 05:27:35

标签: c# .net networking ip-camera

编辑:我知道如何在拥有IP地址时访问摄像头。问题是如何检查本地网络中指定的IP地址是否属于IP摄像机。


我在一个带有一个路由器的小型本地网络中工作。该网络中的可用地址范围是: 从192.168.0.0192.168.0.255

有一台连接到该网络的IP摄像头。该相机的地址为:192.168.0.12

我使用arp -a命令在命令行中查询路由器的ARP表。它显示在这里(绿色)。

enter image description here

我通过 AXIS IP Utility 发现了该地址,但我希望能够以编程方式执行此操作。

相机型号为: Axis m1011w

EDIT2 :感谢OnoSendai,我从路由器的ARP表中获得了可能的IP地址池:

enter image description here

如何查询列出的每个IP地址(例如192.168.0.12)以确保它是IP摄像头?

1 个答案:

答案 0 :(得分:1)

我相信这个模型在端口554提供HTTP RTSP服务。你可以尝试打开它的TCP连接 - 如果设备接受传入连接,那么它可能是摄像头。

如果您有正确的用户名/密码凭据对来访问它,那么您可以使用以下URL访问RTSP服务:

rtsp://[username]:[password]@[ip.address]:554/axis-media/media.amp

以下是其规范的链接:

http://www.axis.com/en/products/cam_m1011w/index.htm

这里有访问说明:

http://www.wowza.com/forums/content.php?39

为了列出本地网络上的所有IP地址,您可以使用此代码段读取ARP命令转储的信息:

    static List<string> GetARP()
    {
        List<string> _ret = new List<string>();

        Process netUtility = new Process();
        netUtility.StartInfo.FileName = "arp.exe";
        netUtility.StartInfo.CreateNoWindow = true;
        netUtility.StartInfo.Arguments = "-a";
        netUtility.StartInfo.RedirectStandardOutput = true;
        netUtility.StartInfo.UseShellExecute = false;
        netUtility.StartInfo.RedirectStandardError = true;
        netUtility.Start();

        StreamReader streamReader = new StreamReader(netUtility.StandardOutput.BaseStream, netUtility.StandardOutput.CurrentEncoding);

        string line = "";
        while ((line = streamReader.ReadLine()) != null)
        {

            if (line.StartsWith("  "))
            {
                var Itms = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                if (Itms.Length == 3)
                    _ret.Add(Itms[0]);
            }
        }

        streamReader.Close();

        return _ret;

    }

该函数将返回包含所有本地IP地址的List<string>(如路由器的ARP表中所示)。