我们的支持团队已经诊断出计算机配置的某些特定区域可能会导致基于网络的数据库应用程序运行缓慢.我的任务是创建一个工具来测试可能的减速问题.我在检测
Windows中是否为其活动网络适配器启用了链接层拓扑时遇到问题.我有一种方法来查找活动(最常用)的网络适配器.
有没有办法检测链接层拓扑,我该如何测试它?
解决方法
不是纯粹的.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/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。