Jump to content
  • Advertisement
Sign in to follow this  
Renegadeandy

WAN IP in C++

This topic is 4156 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I am desperate to find the correct code to find the WAN IP using C++ for one of my applications. I know how to find local IP, but thats not what I need. Does anybody have any code segments which will help me here? Thanks Andy

Share this post


Link to post
Share on other sites
Advertisement
Why do you *need* to know it?

You shouldn't need to know that and it likely won't do you any good anyway. If someone tries to connect to your WAN IP address they'll just get bounced by whichever machine is providing your local IP address. All machines behind the DNS server have exactly the same WAN address.

The typical solution is to have clients connect to a known server address and the server then keeps those connections open and routes all communication through them. Basically, client is responsible for opening sockets so that the server can talk to them

-me

Share this post


Link to post
Share on other sites
I need it for a support bit of software - i must have there WAN IP , however thats not the point you dont need to know *WHY* , just somebody please tell me *HOW*!

Share this post


Link to post
Share on other sites
The only way you can know your global IP is if you contact an outside source (like whatismyip.com). Hosts know nothing about whether or not NAT is enabled.

Share this post


Link to post
Share on other sites
Right, ok - so any hints on how the hell I am going to do that :S!

Or - the other option is , programming somehow to create a remote assistance invitation - which i could then deal with which would cut out that problem.

How would I go about programming that!

Share this post


Link to post
Share on other sites
If you're behind a server that supports UPnP (most home routers do, if that's what you're targeting), IIRC there's a way to query it for a WAN IP, but it's been a few years and I don't remember all the details. If you're on Windows ME or later you can use the UPnP APIs. They're COM-based so you can use them from C++ pretty easily. The ControlPoint API is the one that provides you an interface to a UPnP server.

Alternatively, Platinum UPnP is an open-source, cross-platform API that's used in a lot of applications.

Share this post


Link to post
Share on other sites
I am not that great a programmer, and very early in programming in C++ so I need more of a walkthrough than that.

Can you guide me through this? I know thats a big ask but it would be superb and hey - you would remind yourself all over again of what you need to do!

Thanks in advance,

Andy

Share this post


Link to post
Share on other sites
So, you're trying to write a trojan, that will send out Remote Assistance invites to your computer, so that you can log into them?

And you need the WAN IP so that you know where to connect?

Share this post


Link to post
Share on other sites
No, - please dont spam and ruin this thread. Its for a remote assistance business = upsetpc.com my site.

I could use real vnc or something - but then the client would need to do something and you cannot assume they would a) want to , or b)know how to.

So stop the stupid replys and more of the useful one like 2 posts back!

Share this post


Link to post
Share on other sites
Before starting with coding, realize the following limitations.

- Firewalls will block you. So trying to connect to a machine behind a firewall will require the user to reconfigure their router or software firewall. This is something that is strongly frowned upon.

- No computer will ever allow you to be contacted by 3rd party unless the user specifically set it up (Remote Assistance for example). Any software that would allow third party connection to take control over the computer is a security disaster of cosmic proportions

- If the computer you're trying to assist connects to your server, you have their WAN IP

- No matter which method you wish to use to assist your customers, they'll need to install the software. In addition, they'll need to start it and accept the connection whenever they require assistance. Once again, for security reasons

- Requiring unattended access to computers either via third party software or your own will quickly get you and your software black-listed

- It always helps to be polite and helpful when asking for assistance from volunteers

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!