Hacker News new | ask | show | jobs
by vain 5590 days ago
i am missing something here. why does everyone here seem to think this is cool?
1 comments

Could anyone list some practical uses ?
I built some WebSocket code that calls back to the server. I can't hardcode the "server" ip address because I want to deploy it to different places at different times. Sometimes I'm working on my laptop, sometimes its running on Amazon EC2, etc. So, with something like this I am able to build my Javascript so it always knows how to get back to the server.

<yea, I know there are lots of ways to do this, but this is the one I chose. :) sue me. >

So myipinjosin returns the server's IP address? I thought it would return the clients IP address. (Link is broken atm).

For your use case, relative URLs seem the better solution?

Finding your own external, visible-to-the-internet IP. You're almost always behind some router these days, so using ifconfig or whatever is pretty useless.