Author Topic: Android IPAddress Problem  (Read 4164 times)

Yang

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Android IPAddress Problem
« on: May 22, 2014, 04:45:59 AM »
Hello,I just begin my network coding.And I got the problem.The Tnet example named "Example Menu" don't work correctly in android.When I start a server,the server list don't got updated.However it works fun in editor.It seems to be the IPAddress problem.I tried to Debug it using TNet.Tools.localAddress,then got "10.0.2.15".What is it?It is supposed to be "198.168.1.XX".

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Android IPAddress Problem
« Reply #1 on: May 22, 2014, 04:26:52 PM »
Do you have multiple network interfaces? Check TNet.Tools.localAddresses.

Yang

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Android IPAddress Problem
« Reply #2 on: May 22, 2014, 07:00:58 PM »
No.only one.I use NGUIDebug.Log for debuging in android.By the way,UnityEngine.Network.player.ipAddress does work as escepted.I tried to use IPAddress.Parse(UnityEngine.Network.player.ipAddress) insdead of NetworkInterface.Then my app never crash again.Unfortunately the server list keep unable to get the server started by self.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Android IPAddress Problem
« Reply #3 on: May 23, 2014, 05:41:03 PM »
You can change the local IP address via TNet.Tools.localAddress = SomeNewAddress. What's curious is that it's not showing up for you. TNet grabs those values straight from the system, so it's your system that's not reporting 192.168.x.x's existence. Question is why...

Do you have multiple routers perhaps? The immediate one is 10.x.x.x, then the outer one is 192.168.x.x?