Overview
Features
Download
Documentation
Community
Add-Ons & Services

Best way to get current IP address

Please post support and help requests here.

Best way to get current IP address

Postby syvex » 18 Sep 2012, 16:48

What is the best way to get the current IP address using Poco::Net?

Also, for bonus points, what is the best way to get the *external* IP address?
syvex
 
Posts: 6
Joined: 26 Jan 2010, 05:14
Location: Texas, USA

Re: Best way to get current IP address

Postby Royce » 18 Sep 2012, 22:50

Looks like Poco::Net::NetworkInterface::list() is the guy.

For an external IP, I assume you mean the public address of a NAT setup. Since the NAT's IP isn't actually stored on the box running the code you'll have to contact some other box that will report the NAT address back to you. I'm not sure if there is a free service out there that will do that without requiring you to screen scrape, but if there is you might wind up using Poco::Net::HTTPRequest to fabricate a transmission that would cause the service to reply with your NAT's public IP.
Royce
 
Posts: 19
Joined: 23 Feb 2012, 18:13

Re: Best way to get current IP address

Postby syvex » 19 Sep 2012, 16:14

Perfect. That's what I was looking for!
syvex
 
Posts: 6
Joined: 26 Jan 2010, 05:14
Location: Texas, USA


Return to Support

Who is online

Users browsing this forum: No registered users and 5 guests

cron