Is there a way in GDscript to obtain PC/device IP address?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By sleepy
:warning: Old Version Published before Godot 3 was released.

Is there a way in GDscript to obtain PC/device IP address?

looking in the search help in godot there is an IP class with get_local_addresses(). take a look there :slight_smile:

tiernich | 2016-03-27 15:41

:bust_in_silhouette: Reply From: rwrz

Sure, as our friend (tiernich) said, get_local_addresses() return all your addresses. Here an example:

print("IP:", IP.get_local_addresses())

Outputs:

IP:192.168.1.2, 127.0.0.1

So, just use IP.get_local_addresses() to get a String with all your IPs.

Remember IP.get_local_addresses() returns an array.

Merlin1846 | 2021-04-18 23:04