This Script was originaly Provided by EREN , I have made some modifications to it. now we are having the same Question.
This is a Script which can get all IP addresses assigned to computer.
There are some things in this the IP address which it is getting are in this sequence.
1- First IP address is from Network Card
2- Second one is the PPP , or IP assigned to MODEM if there is not network card then this would be the first one
3- Other IP assigned to Netowrk Card
I want to know is there any other way to get the specific IP address such as which ip is assigned to Modem, and which one is assigned to Network Card.
the code given below, its in C#
This is a Script which can get all IP addresses assigned to computer.
There are some things in this the IP address which it is getting are in this sequence.
1- First IP address is from Network Card
2- Second one is the PPP , or IP assigned to MODEM if there is not network card then this would be the first one
3- Other IP assigned to Netowrk Card
I want to know is there any other way to get the specific IP address such as which ip is assigned to Modem, and which one is assigned to Network Card.
the code given below, its in C#
Code:
using System;
using System.Net;
namespace IPAddress {
class madzone{
static void Main(string[] args) {
string machine_name = Dns.GetHostName();
IPHostEntry host = Dns.GetHostByName(machine_name);
Console.Write("This utility finds all IP addresses assigned to this PC.");
Console.WriteLine("There are " + host.AddressList.Length + " IP Addresses asssigned to this PC");
for (int i=0; i < host.AddressList.Length; i++){
Console.WriteLine("IP # " + (i+1) + " : " + host.AddressList[i]);
}
Console.WriteLine("This is end of search, Press any key to Exit.");
Console.ReadLine();
}
}
}