Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / can AGK get your public IP?

Author
Message
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 5th Nov 2016 14:52
is it possible for AppGameKit to get your public IP?
i know there's a command for your local IP which is great but for multiplayer you need your public IP and expecting players to google this is a bit of a stretch so is it possible to get AppGameKit to return it (which i've missed?) or can i get AppGameKit to google it and show it in the game screen automatically?

BTW the command GetDeviceIP() actually says
Quote: "Returns the IP address of the current device, this can be used by other devices to connect to this device. "
but this isn't true unless they are within the same network as you.
life\'s one big game
spec= 2.6ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic
chamaeleon
10
Years of Service
User Offline
Joined: 8th Mar 2014
Location:
Posted: 5th Nov 2016 17:51
Use a service like https://www.ipify.org and parse the response appropriately? Doesn't get rid of the need for being able to punch through firewalls a lot of the of course, which is where a central server you stand up (or maybe there are services out there) that implements nat traversal and hole punching that both clients connect to.
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 5th Nov 2016 18:32 Edited at: 5th Nov 2016 18:36
Your computer generally doesn't know the public ip. it knows it's own ip, and the gateway ip (lan interface of the router). This means Agk can't simply get the public ip from the machine (the machine doesn't have it)

If Agk has http commands, you can get it by making a request to a site that will return your public ip.

Tgc used to host a url that would do this for fpsc, and made it really easy. this seems to be invalid now though.

Ive used whatismyip.com with dbpro for this, though you have to search through a whole page of html to find and extract it.

Getting the ip is only half the battle though. You also need to setup port forwarding on the host router, configure exceptions in your firewalls, and communicate the host ip to other players to join.


A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 5th Nov 2016 19:20
yh i looked at the http commands but i dont really understand how to use them and trying to get info from www.whatsmyip.org just returns nothing at all so i think i'm using them wrong (just edited the example)


the network code works fine already though yh, ports aren't an issue as that's part of multiplayer after all
life\'s one big game
spec= 2.6ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 5th Nov 2016 19:50
"www.whatsmyip.org" -> .org is invalid, try https://www.whatismyip.com, though they now state that to automate this through a script, you need to subscribe to their membership.

You might try here: https://www.iplocation.net/find-ip-address

extract from this line:

<p style="font-size:1.4em;" align="center">Your IP Address is <span style="font-weight: bold; color:green;">136.62.193.232</span>.</p>




You can also get it off google:

https://www.google.com/search?q=find+my+ip&ie=utf-8&oe=utf-8

you will look for the line:

<div class="vk_sh vk_gy">Your public IP address</div>

and the ip will be on the line directly above it:

<div class="_h4c _rGd vk_h">2605:a601:1170:c3:107c:6dd1:23d8:8b44</div>

(mine is coming up as an IPv6 here, should return an IPv4 just the same though)


A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 5th Nov 2016 21:32
thanks very much, i got it working - i hadn't removed the \ between the site address and the page
life\'s one big game
spec= 2.6ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic

Login to post a reply

Server time is: 2024-09-29 19:20:48
Your offset time is: 2024-09-29 19:20:48