Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

i am trying to find out the IP address,ISP name (internet service provider) and Location of the FTP site.Now, i am in trouble with to find ip address for FTP site.
for example

<pre lang="c#">System.Net.IPAddress[] sIPAddress = null;
sIPAddress= System.net.Dns.GetHostAddresses("ftp://www.codeproject.com");</pre>


it raise some error
Cannot implicitly convert type 'System.Net.IPAddress[]' "

is there any possible solutions to find IP address for FTP sites and there is any way to find the ISP name and location for that IP address. any solutions could appreciated.

regards,
sasi
Posted
Updated 27-Jul-11 6:42am
v2

1 solution

You're not passing in a host name above, which is what the method is looking for.

ftp:// is the protocal, not part of the host name. The above code will work with just "www.codeproject.com", but you can't be sure that there is an IP address.

If you're lucky - that is to say, if the host name for ftp is indeed "ftp" and you can guess the port they would be using - then you write some nslookup[^] code and get the list of hostnames for the domain.

If "ftp" appears in the hostname you could look that up with your code above (less the "ftp://").

Finally, for the ISP and address you'll need to look that up with ARIN.

Cheers.
 
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