.net 3.5: (ip2hostname) 查找某个IP是否被域中的另一台计算机使用
我正在一个域下工作,我正在制作一个应用程序,将 ip 从 1 更改为 253,直到找到一个可用的、无冲突的 ip(它从域获取 ping 响应,每次更改 ip 时都会尝试 ping 它),这部分有效。问题是,我不希望程序覆盖其他被简单关闭的计算机使用的 IP 地址,这就是为什么它在之前的过程中没有与它们发生冲突。
所以我的问题基本上是,
我如何查明我刚刚更改的 IP 是否被我域中的另一台计算机使用? (计算机可能已关闭,否则会发生冲突)
奇怪的问题&任务,我知道。
我不介意使用外部 cmd 工具,将输出流式传输到我的代码,只要它是内置窗口即可。
I'm working under a domain, and im making an app that changes ip from 1 to 253 until it finds an available, unconfliced ip (where it get's ping response from the domain, it tries to ping it each time it changes ip), this part works. the problem is, that i dont want the program to override an ip address that is used by other computers that are simply shut down, and thats why it didnt conflict them in the previous process.
so my question basicly is,
how do i find out if the ip i just changed to is used by another computer in my domain? (computer is probably shutdown or else it would be confliced)
weird question & task, i know.
I don't mind using an external cmd tool, streaming the output to my code, as long as it's built-in windows.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的计算机通过 DHCP 获取 IP,您可以检查 DHCP 租约。
否则,也许您可以从 Active Directory 获取一些信息,但我不确定它是否将 IP 存储在计算机帐户中。
If your computers get their ips by DHCP, you could check the DHCP leases.
Otherwise maybe you can get some information from the Active Directory, but I'm not sure it stores the IP within the computer account.