Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: decerto on August 22, 2016, 05:55:15 PM

Title: TNServerInstance bugged on start and stop?
Post by: decerto on August 22, 2016, 05:55:15 PM
Hello,

Using TNet 3.0. Latest Asset Store release.

I open a server in code using:

  1.         TNServerInstance.Start(25565, 25565, "ServerData.dat", true);
  2.         TNManager.Connect();
  3.         TNManager.JoinChannel(0, "Lobby", false, 5, null, false);


I join the game as normal, it creates a server gameobject with a TNServerInstance script as normal:
(http://puu.sh/qKNGV/8ef86e68cb.png)

Then I disconnect using as well as calling TNManager.Disconnect:
  1.          TNServerInstance.Stop();

It boots me back to the main menu, as normal. However, I press Host server again and:
(http://puu.sh/qKNQx/bb1fa5f601.png)

Clients are unable to join the server. Have to stop and start play testing in unity to set it back to normal.

Am I doing something wrong here, or is this just bugged?
Title: Re: TNServerInstance bugged on start and stop?
Post by: ArenMook on August 22, 2016, 10:45:47 PM
You need to specify different ports. You can't use the same port for both TCP and UDP. I am surprised you don't get an error message...

P.S. The latest is 3.0.3. There was a bug related to this that was fixed in one of the last updates.
Title: Re: TNServerInstance bugged on start and stop?
Post by: decerto on August 22, 2016, 11:08:06 PM
TCP and UDP can be ran on the same port. I've used the same port for both TNet2 and TNet 3 with no problems.

As for the problem being fixed, I'm using the latest asset store 3.0.3 and it happened.
Title: Re: TNServerInstance bugged on start and stop?
Post by: ArenMook on August 23, 2016, 01:26:17 AM
You're right... it seems I accidentally reverted the fix. I'll put up 3.0.4 with the fix re-applied, but you can just set "mListenerPort = 0;" at the end of GameServer.Stop() to fix it on your end right now.