Click here to Skip to main content
16,021,430 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to get BroadBand Modem Ip address in Windows application using vb.net
Posted

Go to this site http://www.whatismyip.com/[^] and it will give you your external IP address.
 
Share this answer
 
Comments
durai.net 17-Oct-11 6:25am    
hi i want to get that ip address through coding part of vb.net in windows application
It depends on which address you want:
If you want the address of the modem on your network, so you can talk to it:
C#
ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'");
ManagementObjectCollection moc = mos.Get();
foreach (ManagementObject mo in moc)
    {
    string[] gateways = (string[])mo["DefaultIPGateway"];
    foreach (string gateway in gateways)
        {
        Console.WriteLine("Gateway: {0}", gateway);
        }
    }
You will need to add a reference to the System.Management namespace
If you want to get the IP address that the modem uses to talk to the Internet (i.e. the IP address that you get called when you are visiting a site) then you have to talk to the internet and get a response - there are quite a few sites which will send you back that information - google will find one you like.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900