NetworkInterface.Speed Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the speed of the network interface.
public:
virtual property long Speed { long get(); };
public:
abstract property long Speed { long get(); };
public virtual long Speed { get; }
public abstract long Speed { get; }
member this.Speed : int64
Public Overridable ReadOnly Property Speed As Long
Public MustOverride ReadOnly Property Speed As Long
Property Value
A Int64 value that specifies the speed in bits per second.
Examples
The following code example demonstrates displaying the speed of interfaces on the local computer.
void ShowInterfaceSpeedAndQueue()
{
array<NetworkInterface^>^adapters = NetworkInterface::GetAllNetworkInterfaces();
System::Collections::IEnumerator^ myEnum9 = adapters->GetEnumerator();
while ( myEnum9->MoveNext() )
{
NetworkInterface ^ adapter = safe_cast<NetworkInterface ^>(myEnum9->Current);
IPInterfaceProperties ^ properties = adapter->GetIPProperties();
IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics();
Console::WriteLine( adapter->Description );
Console::WriteLine( " Speed .................................: {0}",
adapter->Speed );
Console::WriteLine( " Output queue length....................: {0}",
stats->OutputQueueLength );
}
}
public static void ShowInterfaceSpeedAndQueue()
{
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in adapters)
{
IPInterfaceProperties properties = adapter.GetIPProperties();
IPv4InterfaceStatistics stats = adapter.GetIPv4Statistics();
Console.WriteLine(adapter.Description);
Console.WriteLine(" Speed .................................: {0}",
adapter.Speed);
Console.WriteLine(" Output queue length....................: {0}",
stats.OutputQueueLength);
}
}
Public Shared Sub ShowInterfaceSpeedAndQueue()
Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
Dim adapter As NetworkInterface
For Each adapter In adapters
Dim properties As IPInterfaceProperties = adapter.GetIPProperties()
Dim stats As IPv4InterfaceStatistics = adapter.GetIPv4Statistics()
Console.WriteLine(adapter.Description)
Console.WriteLine(" Speed .................................: {0}", adapter.Speed)
Console.WriteLine(" Output queue length....................: {0}", stats.OutputQueueLength)
Next adapter
End Sub
Remarks
The value returned by this property is reported by the network interface. It is not computed dynamically.
Applies to
Bekerjasama dengan kami di GitHub
Sumber untuk kandungan ini boleh didapati di GitHub, di mana anda juga boleh mencipta dan menyemak isu dan menarik permintaan. Untuk maklumat lanjut, lihat panduan penyumbang kami.
Maklum balas
https://aka.ms/ContentUserFeedback.
Akan datang: Sepanjang 2024, kami akan menghentikan secara berperingkat Isu GitHub sebagai kaedah maklum balas untuk kandungan dan menggantikannya dengan sistem maklum balas baharu. Untuk mendapatkan maklumat lanjut lihat:Kirim dan lihat maklum balas untuk