Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

get default gateway ip address using vb.net

Posted on 2003-10-30
1
Medium Priority
?
3,236 Views
Last Modified: 2008-02-07
I am writing a program to provide diagnostic information for laptop users on the road. I wish to find the default gateway assigned by the ISP so I can ping it and check it's responding.

I have written ping code
and I am able to get the machines IP address(es) using this function:
Public Function GetLocalIPAddress() As String
  Dim h As IPHostEntry = Dns.GetHostByName(Dns.GetHostName)
  Dim ip As IPAddress
  Dim strOutput As String
  For Each ip In h.AddressList
    strOutput &= ip.ToString & " "
  next
  GetLocalIPAddress = strOutput.Trim
End Function

I want the default gateway IP as you would be able to get from running IPConfig/all at cmd prompt (but don't want to have to parse the output of a command line program).

Is it possible to do this using vb.net objects.

Thanks, Fiona
0
Comment
Question by:wallacef
1 Comment
 
LVL 2

Accepted Solution

by:
CuSo4 earned 1000 total points
ID: 9651551
Maybe this link can help you: http://www.dotnet247.com/247reference/msgs/18/91898.aspx

It's a VB.NET 'which displays the information of ipconfig /all
which includes the default gateway IP of the machine. It makes use of Ip helper api's
GetNetworkParams and GetAdapterInfo() api'
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question