https://kotlinlang.org logo
Title
n

Nino

06/30/2022, 1:43 PM
Hello, documentation recommends using
<http://0.0.0.0:8080>
, but after starting the server, this address doesn't work.
<http://localhost:8080>
works, tho. Why is it so ?
l

Larry Meadors

06/30/2022, 1:44 PM
i believe that 0.0.0.0 means to bind to all addresses on the machine - so localhost and 127.0.0.1, etc...
👍 2
it is not a valid address
c

christophsturm

06/30/2022, 1:44 PM
you can only listen on 0.0.0.0 not connect to it
e

ephemient

06/30/2022, 2:22 PM
connecting to 0.0.0.0 does work on some operating systems, such as Linux
that's not standard across other OSes, but binding to 0.0.0.0 and listening is definitely a standard feature
c

christophsturm

06/30/2022, 2:24 PM
what do you connect to when you connect to 0.0.0.0? any random interface?
l

Larry Meadors

06/30/2022, 2:24 PM
yeah, 0.0.0.0 is a non-routable address, so connecting to it is kinda...janky
e

ephemient

06/30/2022, 2:26 PM
in practice, you get "any local address" when connecting to 0.0.0.0, same as when binding. it's definitely not something you should rely on to be portable, though
👍 2
l

Larry Meadors

06/30/2022, 2:29 PM
yeah, you said that better than me: it might work..but relying on it to is a Bad Idea (tm) 🙂
e

ephemient

06/30/2022, 7:22 PM
if you only care about Linux then rely away 😛
🤣 1