- Home /
how do you get player external ip address
Network.player.externalIP returns UNASSIGNED_SYSTEM_ADDRESS
The documentation http://docs.unity3d.com/Documentation/ScriptReference/NetworkPlayer-externalIP.html
states "This will only be populated after some external connection has been made"
so how might i do this?
Answer by MichaelTaylor3d · Sep 27, 2012 at 09:21 PM
I found that I can achieve this by placing the following line before I try to access the external ip variable
Network.Connect("http://www.google.com");
Make sure you close the connection when you are finished
Network.Disconnect();
Any idea on choosing a website/server that is available for all countries? i.e. google might be blocked in China...
EDIT: I ended up calling my own server :D.
@shockwave:
It's also not recommended to abuse google for things like that. You could get into massive trouble if your users create too much traffic for google. Almost all big sites don't allow automated use of their site by bots or programs they haven't developed themselfs.
So using your own server is always the best solution ^^
Network.Connect("127.0.0.1"); works on my PC but not on mobile..
Your answer
Follow this Question
Related Questions
Calling System.Net.Dns.GetHostEntry(sHostName) failed 0 Answers
I need an alternative to Network.player.ipAdress 0 Answers
Connect to server over web 1 Answer
Erro in MultiPlayer 0 Answers
Networking ? 2 Answers