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 »

How to get a list of IP addresses associated with a host?


Posted Date: 18 Jun 2007    Resource Type: Code Snippets    Category: Operating System
Author: Abhishek AryaMember Level: Diamond    
Rating: 1 out of 5Points: 10



The method returns a string array containing IP addresses that resolve to the host name.


public string[] getIPList(string hostName)
{
/*
This method is created by Anton Zamov.web site: http://zamov.online.fr

Feel free to use and redistribute this method in condition that you keep this message intact.
*/

IPHostEntry IpEntry=new IPHostEntry();

int counter = 0;

string[] strResult=new string[100];

try
{
foreach(IPAddress Ip in iphostentry.AddressList)
{
strResult[counter++]=Ip.ToString();
}
}
catch(Exception exc)
{
// TODO
}

return strResult;
}



Responses

Author: akku    08 May 2008Member Level: Silver   Points : 2
cool one


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

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: Find out Running Task Manager Process
Previous Resource: Change System DateFormat Runtime
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