getting ip from server with code

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By theMX89

hi, so im trying to make a little programm that can get the ip of a server and display it, kinda like you can do in a terminal, just with a textedit where you put in the servers name and it gives you the ip.

image: showcase hosted at ImgBB — ImgBB (the highlightet part is the ip i want to get in godot)

if someone knows, is it possible to also locate the ip from the server directly in godot?

:bust_in_silhouette: Reply From: jgodfrey

Is this what you want?

var ip = IP.resolve_hostname("google.com")
print(ip)

Here, that prints 142.250.72.14, which matches the IP returned by ping google.com in my case.

Yes! Thanks, couldnt find anything on google. Do you know if its also possible to locate the ip directly in godot like these ip finder websites?

theMX89 | 2022-06-04 05:54