Author Topic: TCP Lobby  (Read 2947 times)

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
TCP Lobby
« on: July 18, 2016, 03:45:26 AM »
Spent a good part of the last few hours wondering why I'm not connecting to a remote TCP lobby...

Commenting out line #235 in TNTcpLobbyServer.cs made everything; magically start working as expected.   :o

  1. long lastSendTime = tc.Get<long>("lastSend");//#234
  2. if (lastSendTime == 0) continue;//#235
  3.  

Any idea's or perhaps a eureka moment?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TCP Lobby
« Reply #1 on: July 20, 2016, 03:41:02 AM »
This value is set when the lobby server receives the RequestServerList packet on line 332. At this point it knows that this connection is with a lobby listener, and not a server. When sending a list of servers, it's only sent to listeners, which is what line 235 does.

The request for a server list is sent out by TcpLobbyClient on line 79. Does the game ID match?

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
Re: TCP Lobby
« Reply #2 on: July 20, 2016, 06:33:55 AM »
This value is set when the lobby server receives the RequestServerList packet on line 332. At this point it knows that this connection is with a lobby listener, and not a server. When sending a list of servers, it's only sent to listeners, which is what line 235 does.

The request for a server list is sent out by TcpLobbyClient on line 79. Does the game ID match?

I havent set or changed gameID...  and checked this while tracing the problem.  I'll double check again tomorrow with fresh copies.

  1. static public ushort gameID = 1;//line #38 of TNGameServer.cs
  2.  

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
Re: TCP Lobby
« Reply #3 on: July 20, 2016, 10:06:40 PM »
made a new project and compiled a new copy of the standalone server.  same results...  with the setup below I get nothing -- with line #235 commented out in visual studio (2nd test) everything works as expected.

Remote Lobby:
".....\TNServer.exe" -name LOBBY -tcpLobby 10421

Remote Server:
".....\TNServer.exe" -name TESTSERVER -tcp 10424 -tcpLobby 192.168.1.102 10421

  1. using System.Collections;
  2. using TNet;
  3. using UnityEngine;
  4.  
  5. [RequireComponent(typeof(TNTcpLobbyClient))]
  6. public class demo : MonoBehaviour
  7. {
  8.     public string remoteAddress = "192.168.1.102";
  9.     public int remotePort = 10421;
  10.  
  11.     private TNTcpLobbyClient tcplobbyclient;
  12.    
  13.     private void OnEnable()
  14.     {
  15.         TNLobbyClient.onChange += OnChange_List;
  16.     }
  17.    
  18.     private void OnDisable()
  19.     {
  20.         TNLobbyClient.onChange -= OnChange_List;
  21.     }
  22.  
  23.     private void Awake()
  24.     {
  25.         tcplobbyclient = GetComponent<TNTcpLobbyClient>();
  26.  
  27.         tcplobbyclient.remoteAddress = remoteAddress;
  28.         tcplobbyclient.remotePort = remotePort;
  29.     }
  30.  
  31.     private IEnumerator Start()
  32.     {
  33.         while (TNManager.isJoiningChannel) yield return null;
  34.  
  35.         //wait until ready to use
  36.         tcplobbyclient.enabled = true;
  37.     }
  38.  
  39.     private void OnChange_List()
  40.     {
  41.         Debug.Log("OnChange_List");
  42.     }
  43. }
  44.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TCP Lobby
« Reply #4 on: July 21, 2016, 12:16:20 PM »
I can have another look at it in a bit, but do you even get the RequestServerList packet? Try adding a Debug.Log there (around line 332). You can also print exactly which packets are coming in to the lobby server.