C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Operating System »

Getting System Information


Posted Date: 24 Apr 2009    Resource Type: Code Snippets    Category: Operating System
Author: One EarthMember Level: Gold    
Rating: 1 out of 5Points: 7



Getting the Information about IP address of the system ,DNS name and NETbios names are really cool features provided by .net .Its very simple and really come handy for developers and an immemnse respite from hardcore network coding.

All you got to do is include the System.Net namespace and rest is as follows : -



using System.Net;



static void Main(string[] args)

{

//get the name of your system

Console.WriteLine("Name of the system is: {0}", DNS.GetHostName);



IPHostEntry Iplist = Dns.GetHostByName(host);


//IPHostEntry class provides a container class for intenet host //address information. It associates a Domain Name System (DNS) host name with an array of aliases and an array of matching IP addresses.



foreach (IPAddress ip in iplist.AddressList)

//.AddressList gets a list of IP addresses that are associated with a particular host.

{

Console.WriteLine("Your IP address is: " + ip.ToString());
}



//get the Nebios computer name

Console.WriteLine( NetBIOS: {0} ,System.Environment.MachineName);
}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
NetBIOS Name  .  IPaddress  .  DNS Host Name  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Shutting Down , Restarting or Logging Off Computer in a Simple Way
Previous Resource: Environment Class in C#
Return to Discussion Resource Index
Post New Resource
Category: Operating System


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use