Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Snippet] Get Local Getway
#1
Gets the local gateway
Usage: MsgBox(localgateway)

Code:
Function localgateway() As String
        Dim NetworkAdapters() As NetworkInterface = NetworkInterface.GetAllNetworkInterfaces
        Dim myAdapterProps As IPInterfaceProperties = Nothing
        Dim myGateways As GatewayIPAddressInformationCollection = Nothing

        For Each adapter As NetworkInterface In NetworkAdapters
            myAdapterProps = adapter.GetIPProperties
            myGateways = myAdapterProps.GatewayAddresses
            For Each Gateway As GatewayIPAddressInformation In myGateways
                If Not Gateway.Address.ToString = "0.0.0.0" Then
                    Return (Gateway.Address.ToString)
                Else
                    Return ("0.0.0.0")
                End If
            Next
        Next
    End Function
USB Anti-virus? Try USB Drive Defender
[Image: 8bQCusS.jpg]
Reply
#2
Not sure where you would need this, but interesting share none the less. Thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [VB.Net] Local/Remote TCP info from process [Source] The-One 5 3,836 08-11-2012, 05:18 PM
Last Post: Kenneth
  [Snippet] Autoclose Msgbox euverve 7 3,045 05-25-2011, 06:41 PM
Last Post: Pyratepig
  [Snippet] Check Email if gmail and valid password length euverve 4 1,444 05-20-2011, 06:51 AM
Last Post: stephen5565
  [Snippet] Get OS Uptime euverve 0 800 05-12-2011, 07:08 PM
Last Post: euverve
  [Snippet] Random pick from list (Range) euverve 0 638 05-12-2011, 08:22 AM
Last Post: euverve

Forum Jump:


Users browsing this thread: 1 Guest(s)