Author Topic: ExampleMenu couldn't find my local machine's ip?  (Read 19097 times)

blueskined

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
ExampleMenu couldn't find my local machine's ip?
« on: February 20, 2013, 03:49:48 AM »
the example menu working well for 1.3
when I update to 1.5, this example doen't work anymore. when I click start a local server, I can see actually the serverlist's ip is my external ip instead of a Internal IP.
when I click the list button to try to connect, it failed, the message: invald arguments.
what can possibly wrong?

blueskined

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #1 on: February 20, 2013, 03:50:39 AM »
I created brand new scene and imported TNet.

blueskined

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #2 on: February 20, 2013, 03:53:13 AM »
I tried on both my Mac and PC, same result.

blueskined

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #3 on: February 20, 2013, 03:53:57 AM »
the standlone TNServer.exe working without any problem though.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #4 on: February 20, 2013, 06:46:52 AM »
Everything is fine here. Did you try importing TNet into a brand new project to make sure something didn't go wrong with the upgrade process?

I actually tested it (and just re-tested it) on two different connections -- cable connection going through a router (has UPnP) and a DSL connection going through a gateway (no UPnP).

blueskined

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #5 on: February 20, 2013, 06:59:53 AM »
I imported to brand new scene, both on pc, and mac. same result, will that be possible some setting of my route is wrong? but the old version does work properly...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #6 on: February 20, 2013, 07:14:12 AM »
Where is it failing with "invalid arguments"? It should show you the info.

When in doubt, also make sure to delete "server.dat" file prior to starting up the server.

blueskined

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #7 on: February 20, 2013, 07:25:29 AM »
I start a new scene, so there shouldn't be a server.dat file, but after last time I tested the scene, a dat file do generated, I deleted it.
start, same again, the invald arguments didn't show in console, instead, it actually showed in the lable...
here is the screenshot I captured.


it's really weird...

blueskined

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #8 on: February 20, 2013, 08:47:24 AM »
I think it might be something to do with TNUdp Lobby Client script on TNManager. I am turning it on and off, the list working for 1 time!!!!!! displayed the correct ip, and shortly not working again...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #9 on: February 20, 2013, 09:04:07 AM »
That text label is set on line 174 of ExampleMenu (OnNetworkConnect function). My guess is that you are getting an error in TcpProtocol line 171, which goes into the catch() block below. It first tries to connect to your remote IP (if you see it wait for 3 seconds it means it tries and fails). It then tries connect to your local IP (192.168.x.x). Check what the "mFallback" is set to in TcpClient.CancelConnect.

blueskined

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #10 on: February 20, 2013, 09:33:01 AM »
I am not sure what is that mean :o

what I am experience is, when I click "Start a Local Server", it keeps me wait quite long, about 3 seconds.
then the list page popup, with the wrong IP.

but everything is from assetstore, I didn't touch anything! why it can be some callback issue?
anyone else got the same problem? or just me!?
how lucky i am...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #11 on: February 20, 2013, 07:22:27 PM »
The fact that it can't connect to your PC on the first try tells me that the router you have doesn't support address loopback (the ability to connect to your computer using the external address from the inside) -- which is generally a sign of a poor router. Regardless though, it should still work on the second attempt when it tries to connect using the local IP. The fact that it fails at that stage tells me that your network configuration is something I haven't encountered before, so the only way I can help out is if you give me more information, such as the address it tries to connect to. You can get it by adding a Debug.Log statement to the TcpProtocol.Connect -- what is the internal IP?
« Last Edit: February 21, 2013, 09:19:21 PM by ArenMook »

blueskined

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #12 on: February 20, 2013, 08:37:19 PM »
the internal ip is 192.168.1.6.
I am not sure what router that is, the server supplier installed it when they setup the service. I never touch it after that. however, I just tried this again in my company- with my mac laptop which is brand new download from assetstore (the previous try were on my PC and MAC desktop at home yesterday)
and still I only got the company's external ip.
(mac powerbook retina with wifi) :o
I will try more later at home with debug info, have to back to work for now...

blueskined

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #13 on: February 20, 2013, 08:38:35 PM »
if it's the router's problem....
1.3 does run properly!!!!!!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ExampleMenu couldn't find my local machine's ip?
« Reply #14 on: February 20, 2013, 08:49:13 PM »
1.3 doesn't have IP discovery or UPnP features that interact with the router.

As I mentioned, you will have to add Debug.Logs to figure out what the issue is. I can't reproduce it here, so I can't debug it or fix it.