Getting Remote IP address!!  
Author Message
TheMaj0r





PostPosted: .NET Framework Networking and Communication, Getting Remote IP address!! Top

Hello,

My computer is connected to the internet with other computers thru a router, my LAN ip is 10.0.0.84, but it is not the WAN, so how can i write a windows or console app that gets the WAN IP

Thanks




.NET Development36  
 
 
ahmedilyas





PostPosted: .NET Framework Networking and Communication, Getting Remote IP address!! Top

you can't really. The best thing to do is maybe use some webpage/site that gives you your IP Address than parse that, or use some webservice, if one exists, to give you back your IP Address.

AFAIK you can't really "go out" to check your IP, since you are behind a router therefore you will only get private IP address, since that has been assigned to your NIC.



 
 
TheMaj0r





PostPosted: .NET Framework Networking and Communication, Getting Remote IP address!! Top

Hmm i c, another question: so how can i get my pc which is behind the router, i mean get to my ftp site hosted at my pc

 
 
ahmedilyas





PostPosted: .NET Framework Networking and Communication, Getting Remote IP address!! Top

in .NET you can use the Ftp classes in .NET 2.0:

http://msdn2.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=847973&SiteID=1

you could also use the WebClient class:

http://msdn2.microsoft.com/en-us/library/system.net.webclient.aspx

example(s) and docs are included in the link, and hope you find it useful.

now, you need to create an ftp server and what not, then open the ports on your firewall and allow access to it, only then can you start using the ftp classes/access your ftp site.

 



 
 
RizwanSharp





PostPosted: .NET Framework Networking and Communication, Getting Remote IP address!! Top

See this:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=948963&SiteID=1

Best Regards,

Rizwan



 
 
TheMaj0r





PostPosted: .NET Framework Networking and Communication, Getting Remote IP address!! Top

Thanks RizwanSharp ,

Ahmed my problem is not in implementing the ftp client but is in the access to my ftp site, note that i am behind a router so the real ip is the ip for the router while my comp and other 10 connected together share the same real ip. So the external request to my real ip address reaches to the router but it couldnt be forwarded to my pc, ... note that i cannot configure my router to enable port forwarding.



 
 
ahmedilyas





PostPosted: .NET Framework Networking and Communication, Getting Remote IP address!! Top

this is all done at the router level. you would have to open ports to your computer private IP Address in the router configuration page.

 
 
TheMaj0r





PostPosted: .NET Framework Networking and Communication, Getting Remote IP address!! Top

well, but this way trojans wouldn't work since ,suppose i am the victim and you r the attacker, the server is located at my pc and the client at urs u can send requests to the server without configuring router of course, hmm

 
 
ahmedilyas





PostPosted: .NET Framework Networking and Communication, Getting Remote IP address!! Top

not sure I follow. Regarding your original requestion, to obtain your WAN IP, you would need to say go to a site which looks up your IP then parse the page in some way or use a web service of some sort.

in regards to configuring your router or setting up your computer for FTP, im afraid this goes beyond the scope of the development forums and becomes more of an admin/management type question :-)

obviously you need user credentials set up so no one can just log in without permission/request. you also implement a firewall solution to protect hackers as well as anti virus software.



 
 
TheMaj0r





PostPosted: .NET Framework Networking and Communication, Getting Remote IP address!! Top

I dont think so, i am already in development, i talking about something called reverse connecting - i am not sure - this allows u to connect to PCs behind routers programatically, i mentioned trojans which nearly do the same function