简体   繁体   English

如何使用C#设置指定网络适配器的链接速度和双工模式

[英]How to use C# to set the linkspeed and duplex mode of designated Network Adapter

在此处输入图片说明

Just like the screenshot, I want to use C# to set the Link Speed and Duplex mode for Network adapters. 就像屏幕截图一样,我想使用C#为网络适配器设置链接速度和双工模式。 For example, change the settings from Auto Negotiation to 10 Mbps Half Duplex. 例如,将设置从“自动协商”更改为“ 10 Mbps Half Duplex”。

Could you please point me out that how to start? 您能指出我该如何开始吗?

Thanks 谢谢

SuT SUT

The windows network configuration dll's are poorly (in best cases) documented. Windows网络配置dll的文献资料很少(最好)。 The easiest way for configuring values in the network is using netsh 在网络中配置值的最简单方法是使用netsh

Best way to programmatically configure network adapters in .NET 在.NET中以编程方式配置网络适配器的最佳方法

The netsh calls the weird undocummented windows dll's. netsh调用了奇怪的未压缩的Windows dll。 If you need call directly a dll instead of executing a command, you can start debugging the netsh. 如果您需要直接调用dll而不是执行命令,则可以开始调试netsh。

You can use C# to change the registry value of DuplexSpeed in the registry key 您可以使用C#更改注册表项中DuplexSpeed的注册表值

HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001

that I found from here, https://superuser.com/questions/258746/change-nic-speed-duplex-settings-in-script .The number at the end will differ, but you can look at the DriverDesc value of the keys to see the name of the network device. 我从这里找到, https://superuser.com/questions/258746/change-nic-speed-duplex-settings-in-script末.The数量会有所不同,但你可以看看DriverDesc值键以查看网络设备的名称。

See http://tech.pro/tutorial/652/csharp-snippet-tutorial-editing-the-windows-registry for editing registry values with C#. 有关使用C#编辑注册表值的信息,请参阅http://tech.pro/tutorial/652/csharp-snippet-tutorial-editing-the-windows-registry

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM