Reputation: 51
I want to get the information about the the machine configuration i.e like ip address of the machine
Upvotes: 4
Views: 494
Reputation: 55039
You can use System.Net.Dns
to get out stuff like hostname and IP Address(es). But you might need to use other classes for other information.
http://msdn.microsoft.com/en-us/library/system.net.dns.aspx
Upvotes: 0
Reputation: 17038
The Environment class will get some detail about the machine name, logged on user etc. You can use get the IP Address from that:
System.Net.Dns.GetHostByName(Environment.MachineName);
Or just use:
System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName());
Upvotes: 1
Reputation: 3364
Dns Class
I think the below link will help you in the above context
http://msdn.microsoft.com/en-us/library/system.net.dns.aspx
Upvotes: 0
Reputation: 942010
For general machine information, you'll want to use WMI. It is supported by the classes in the System.Management namespace, in particular the ManagementQuery class.
The best way to get started on this is the WmiCodeCreator utility. It lets you discover what WMI classes are available on the machine and run queries. Best of all, it auto-generates the C# code you need, ready to cut-and-paste into your program. Strongly recommended.
Upvotes: 3
Reputation: 5861
you may use Dns for ip/host information and Environment for generic system information (os, version)
Upvotes: 6
Reputation: 53944
Have a look at Sytem.Environment, too, though it will not tell your the ip address. But you can find:
For an IP look at the Dns-class, as klausbyskov or Andrey suggested.
Upvotes: 2