Author Topic: TNServerInstance bugged on start and stop?  (Read 2238 times)

decerto

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 20
    • View Profile
TNServerInstance bugged on start and stop?
« 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:


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:


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?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNServerInstance bugged on start and stop?
« Reply #1 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.

decerto

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: TNServerInstance bugged on start and stop?
« Reply #2 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNServerInstance bugged on start and stop?
« Reply #3 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.