有没有办法检测链接层拓扑,我该如何测试它?
解决方法 不是纯粹的.Net解决方案,但似乎有效. Function接受本地连接的名称和协议名称.我有一个链接到一个具有许多不同协议驱动程序名称的站点,但您想要的那些包含在代码中.这使用nvspbind.exe,你可以从http://archive.msdn.microsoft.com/nvspbind获得.
码
class Program{ static voID Main(string[] args) { //check link-Layer topology discover Mapper I/O Driver bool result1 = IsProtocalEnabled("Local Area Connection","ms_lltdio"); //check link-Layer topology discovery Responder bool result2 = IsProtocalEnabled("Local Area Connection","ms_rspndr"); } private static bool IsProtocalEnabled(string adapter,string protocol) { var p = new System.Diagnostics.Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.filename = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"nvspbind.exe"); p.StartInfo.Arguments = string.Format("/o \"{0}\" {1}",adapter,protocol); p.Start(); string output = p.StandardOutput.ReadToEnd(); p.WaitForExit(); return output.Contains("enabled"); }}
我从这里获得了协议驱动程序名称:http://djseppie.wordpress.com/category/windows/scripting/
总结以上是内存溢出为你收集整理的c# – 检测计算机上是否启用了链接层拓扑全部内容,希望文章能够帮你解决c# – 检测计算机上是否启用了链接层拓扑所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)