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 / URL to IP Address

Author
Message
Parry
AGK Developer
14
Years of Service
User Offline
Joined: 16th Dec 2009
Location: Swampstone
Posted: 5th Jul 2021 00:32
Anyway to resolve an url to IP Address in agk??
Counterparry
DarkDIRE RPG a roguelike game build with AppGameKit Tier 2
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 5th Jul 2021 01:11 Edited at: 5th Jul 2021 01:16
You may want to make a http request to an official dns service.


Or you can directly use a tcp socket, if you want to do it bare-bone:
http://serverfault.com/questions/173187/what-does-a-dns-request-look-like

Or you use the runapp feature, start a batch file with:


is run and the result will be printed to a file, that you can parse the ip.

TamBam
12
Years of Service
User Offline
Joined: 29th Nov 2011
Location: India
Posted: 9th Jul 2021 08:49
What purpose you want this ?
Like I have a game and server hosted on amazon ec2 . and I don't use static ip . so their I install noIp service its free . they give me some url and I use

http = CreateHTTPConnection()
SetHTTPHost( http, "the url here ", 0 )

and its get me to the IP address .
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Jul 2021 20:08
Quote: "Like I have a game and server hosted on amazon ec2"

I'm sure a lot of people would be interested (Me included) in how you set that up and implemented it.
Parry
AGK Developer
14
Years of Service
User Offline
Joined: 16th Dec 2009
Location: Swampstone
Posted: 17th Jul 2021 03:09 Edited at: 17th Jul 2021 03:10
What purpose you want this ?

A player hosting my game's server wants his players to connect to his server with a url instead of having to type out an IP address.
Counterparry
DarkDIRE RPG a roguelike game build with AppGameKit Tier 2
TamBam
12
Years of Service
User Offline
Joined: 29th Nov 2011
Location: India
Posted: 17th Jul 2021 17:51
@BlinkOK . if you use SetHTTPHost( http, "www.appgamekit.com", 0 ) , this " appgamekit.com " actually return a IP address . or even you use commend for Multiplayer Games ( HostNetwork or JoinNetwork) you need to put IP address . so in my AWS EC2 I have a IP address but it change upon restart or or for some others reason because I am not using static or elastic IP address . So I use https://www.noip.com/ setvice it's free for 3 custom url . you need to install small software and its track your pc/AWS ec2 ip address every 5 minuets . I hope you understand but still If you are not clear then tell me I try to make a YouTube video but my English not good .
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Jul 2021 20:20
Thanks you Mr Bam!
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 18th Jul 2021 03:04 Edited at: 18th Jul 2021 08:21
@tambam, making sure that you're talking about a need for additional software to return the IP address, correct? otherwise, i don't see the solution in what you offer.

meanwhile:
jack wrote: "You may want to make a http request to an official dns service."

this returns the IP via DNS lookup (@ google) but it's not perfect where it doesn't account for errors:

the full response appears to be JSON where the first variable "Status" will be 0 on success or 3 on error.

i could parse that but i imagine someone could take the above & properly handle the JSON response?

see the link at the bottom: https://dns.google/query?name=google.com

note: while playing with this i noticed google's IP changes much more frequent than "every 5 minutes" at times.

add: apparently some return multiple IP addresses with a comment that my code doesn't account for:

so, more parsing required, or, again, proper JSON handling (if possible?).

but, we're getting close.
[My Itch.io Home] [Community Apps on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 18th Jul 2021 05:12 Edited at: 18th Jul 2021 05:38
Fully parsed:


reverse lookup with the same method: https://dns.google/query?name=8.8.8.8

added to code snippets
[My Itch.io Home] [Community Apps on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 19th Jul 2021 00:31
Awesome stuff!!

Login to post a reply

Server time is: 2024-04-25 17:52:08
Your offset time is: 2024-04-25 17:52:08