Support => TNet 3 Support => Topic started by: blueskined on February 20, 2013, 03:49:48 AM
Title: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined 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?
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined on February 20, 2013, 03:50:39 AM
I created brand new scene and imported TNet.
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined on February 20, 2013, 03:53:13 AM
I tried on both my Mac and PC, same result.
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined on February 20, 2013, 03:53:57 AM
the standlone TNServer.exe working without any problem though.
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: ArenMook 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).
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined 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...
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: ArenMook 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.
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined 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. (http://i.imgur.com/lqdfSJc.png)
it's really weird...
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined 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...
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: ArenMook 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.
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined 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...
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: ArenMook 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?
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined 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...
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined on February 20, 2013, 08:38:35 PM
if it's the router's problem.... 1.3 does run properly!!!!!!
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: ArenMook 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.
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined on February 21, 2013, 08:13:59 AM
I can't find TcpClient.Connect
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined on February 21, 2013, 10:56:36 AM
does this mean anything to you!?
TypeInitializationException: An exception was thrown by the type initializer for System.Collections.Generic.EqualityComparer`1 TNet.List`1[TNet.TcpPlayer].Remove (TNet.TcpPlayer item) (at Assets/TNet/Common/TNList.cs:142) TNet.TcpChannel.RemovePlayer (TNet.TcpPlayer p) (at Assets/TNet/Server/TNTcpChannel.cs:82) TNet.GameServer.SendLeaveChannel (TNet.TcpPlayer player, Boolean notify) (at Assets/TNet/Server/TNGameServer.cs:823) TNet.GameServer.RemovePlayer (TNet.TcpPlayer p) (at Assets/TNet/Server/TNGameServer.cs:382) TNet.GameServer.Stop () (at Assets/TNet/Server/TNGameServer.cs:232) TNServerInstance.Disconnect () (at Assets/TNet/Client/TNServerInstance.cs:258) TNServerInstance.OnDestroy () (at Assets/TNet/Client/TNServerInstance.cs:274)
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined on February 21, 2013, 11:29:36 AM
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: ArenMook on February 21, 2013, 09:16:26 PM
Did you change the function definition for Example Menu's OnNetworkConnect function? Or did you just add a Debug.Log in there? Hard to tell from your stack trace. You need to put the Debug.Log in the places I mentioned, not in that function.
P.S. The correct function is TcpProtocol.Connect.
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined on February 23, 2013, 01:58:43 AM
y~I couldn't find the TcpClient.Connect, so I tried to put a debug to ExampleMenu.
but I couldn't find TcpProtocol.Connect either(search whole solution) I found a instance of TcpProtocal in TNGameClient, I am not sure if this is what you mean?
// TCP connection is the primary method of communication with the server.
but nothing be throwed out when I click the button with my external ip.
I am a bit lost in your scripts, is that possible you can add a debug info and send me that file, that will be a lot more efficient for both of us! Thank you very much.
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: ArenMook on February 23, 2013, 02:48:57 AM
It sounds like you are very new to scripting -_-
Ping me on skype (arenmook) and I will help you out. It will be easier that way.
Title: Re: ExampleMenu couldn't find my local machine's ip?
Post by: blueskined on February 23, 2013, 03:32:58 AM
That's true, I am not very experienced, Thank for helping me out, I will keep my question minimal, all more general questions I wouldn't ask here. I just friended you on skype, plz check.