How to get localhostname

Is there a way to get the “local host name” in crystal? I didn’t find one by googling and wasn’t sure which class to look in. Java’s equivalent would be InetAddress.getLocalHostName
Thanks!

Hello.
You may be looking for System.hostname.

https://crystal-lang.org/api/0.31.1/System.html#hostname-class-method

1 Like

That worked, thanks!

It’s in kind of a funky location since it’s more of a network thing in my head, but at least it’s there, thank you!