本文介绍了检测IP地址冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我的应用程序具有允许用户设置运行它的系统的IP地址的功能。在更新NIC设置之前,我的应用程序是否有办法检测用户输入的IP地址是否已被网络上的任何其他设备占用?如果发生IP冲突,我打算显示我自己的自定义消息框,如果发生IP冲突,我不想更新NIC卡设置。 我能想到解决此问题的两种方法: 1.对输入的IP地址执行网络ping并等待响应。但是,如果系统已被禁用以响应ping,此方法是否无法检测到IP地址冲突? 2.获取当前所有IP地址的列表网络并检查输入的IP地址是否已存在。在.Net中,如何确定网络中所有IP地址的列表? 请注意我正在寻找一种解决问题的程序化方法。解决方案 My app has a feature to allow users to set the IP address of the system on which it is running. Is there any way for my application to detect if the IP address entered by the users is already taken by any other device on the network before I update the NIC settings ? I intend to display my own custom message box if this IP conflict occurs and I dont want to update the NIC card settings if an IP conflict has occured.I can think of 2 approaches for this issue:1. Do a network ping for the entered IP address and wait for a response. But would this method fail to detect an IP address conflict if a system has been disabled to respond to pings ?2. Get a list of all IP addresses in the current network and check if the entered IP address already exists. In .Net , how do I determine the list of all IP addresses in the network ?Please see that I am looking for a programmatic approach to solving the issue. 解决方案 这篇关于检测IP地址冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 13:30
查看更多