22-08-23, 01:51 PM
(آخر تعديل لهذه المشاركة : 22-08-23, 01:53 PM {2} بواسطة ابو محمد محمد محمد.)
كود :
Dim interfaceb As NetworkInterface
For Each interfaceb In NetworkInterface.GetAllNetworkInterfaces()
' Print the interface name and InterfaceType.
Label1.Text = interfaceb.Name & " " & interfaceb.NetworkInterfaceType
Nextكود :
Public Shared Sub ShowNetworkInterfaces()
Dim computerProperties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
Dim nics As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
Console.WriteLine("Interface information for {0}.{1} ", computerProperties.HostName, computerProperties.DomainName)
If nics Is Nothing OrElse nics.Length < 1 Then
Console.WriteLine(" No network interfaces found.")
Return
End If
Console.WriteLine(" Number of interfaces .................... : {0}", nics.Length)
For Each adapter As NetworkInterface In nics
Dim properties As IPInterfaceProperties = adapter.GetIPProperties()
Console.WriteLine()
Console.WriteLine(adapter.Description)
Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length, "="c))
Console.WriteLine(" Interface type .......................... : {0}", adapter.NetworkInterfaceType)
Console.WriteLine(" Physical Address ........................ : {0}", adapter.GetPhysicalAddress().ToString())
Console.WriteLine(" Operational status ...................... : {0}", adapter.OperationalStatus)
Dim versions As String = ""
If adapter.Supports(NetworkInterfaceComponent.IPv4) Then
versions = "IPv4"
End If
If adapter.Supports(NetworkInterfaceComponent.IPv6) Then
If versions.Length > 0 Then
versions += " "
End If
versions += "IPv6"
End If
Console.WriteLine(" IP version .............................. : {0}", versions)
ShowIPAddresses(properties)
If adapter.NetworkInterfaceType = NetworkInterfaceType.Loopback Then
Continue For
End If
Console.WriteLine(" DNS suffix .............................. : {0}", properties.DnsSuffix)
Dim label As String
If adapter.Supports(NetworkInterfaceComponent.IPv4) Then
Dim ipv4 As IPv4InterfaceProperties = properties.GetIPv4Properties()
Console.WriteLine(" MTU...................................... : {0}", ipv4.Mtu)
If ipv4.UsesWins Then
Dim winsServers As IPAddressCollection = properties.WinsServersAddresses
If winsServers.Count > 0 Then
label = " WINS Servers ............................ :"
ShowIPAddresses(label, winsServers)
End If
End If
End If
Console.WriteLine(" DNS enabled ............................. : {0}", properties.IsDnsEnabled)
Console.WriteLine(" Dynamically configured DNS .............. : {0}", properties.IsDynamicDnsEnabled)
Console.WriteLine(" Receive Only ............................ : {0}", adapter.IsReceiveOnly)
Console.WriteLine(" Multicast ............................... : {0}", adapter.SupportsMulticast)
ShowInterfaceStatistics(adapter)
Console.WriteLine()
Next
End SubNetworkInterface Class
