本文整理匯總了VB.NET中System.Net.NetworkInformation.NetworkChange類的典型用法代碼示例。如果您正苦於以下問題:VB.NET NetworkChange類的具體用法?VB.NET NetworkChange怎麽用?VB.NET NetworkChange使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了NetworkChange類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: NetworkingExample
' 導入命名空間
Imports System.Net
Imports System.Net.NetworkInformation
Public Class NetworkingExample
Public Shared Sub Main()
AddHandler NetworkChange.NetworkAddressChanged, AddressOf AddressChangedCallback
Console.WriteLine("Listening for address changes. Press any key to exit.")
Console.ReadLine()
End Sub
Private Shared Sub AddressChangedCallback(ByVal sender As Object, ByVal e As EventArgs)
Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
Dim n As NetworkInterface
For Each n In adapters
Console.WriteLine(" {0} is {1}", n.Name, n.OperationalStatus)
Next n
End Sub
End Class