Author Topic: TNManager.Connect question  (Read 5380 times)

pyscho2day

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 74
    • View Profile
TNManager.Connect question
« on: July 17, 2013, 03:48:36 PM »
Is it possible to have one open connection say to a local server then use a second connection to look for a different server that has more than 1 player?

example

I look for a suitable server. (has less then max players and ping under predesignated #)
I don't find server so start my own.
I then connect to my server.

Can I then look for a suitable server? (this entails connecting to the server to get the ping)

also if there is a better way to get the ping then that would be great.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNManager.Connect question
« Reply #1 on: July 18, 2013, 03:04:25 AM »
TNManager.Connect establishes an active connection with a server. Server list comes from an active Lobby connection, which is a different component altogether. You can keep an active lobby server connection while remaining connected to an actual server.

pyscho2day

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 74
    • View Profile
Re: TNManager.Connect question
« Reply #2 on: July 18, 2013, 12:27:15 PM »
I already knew that, the problem is that until some one else connects to the server I just made I want to keep looking to see if a spot on a server opens up.  The first thing I check is the player count and that is fine, then next thing is the ping.

From everything I have read, currently you have to connect to that server to get the ping. My question is can TNManager.Connect start a second active connection so that I can get the ping and then disconnect from it and not the connection I have to the server I created.

If I am not making sense let me know.

pyscho2day

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 74
    • View Profile
Re: TNManager.Connect question
« Reply #3 on: July 18, 2013, 09:28:41 PM »
Ok, I was able to test this today and from what I have seen if you are already connected to a server and try and connect to a second server it will not connect.

If you have any ideas how i can have a second active connection so that i can get a ping that would be greatly appreciated.


EDIT:
I am trying the below code and it will not connect to the server at all.

  1. GameClient myGameClient = new GameClient();
  2. myGameClient.Connect(TNLobbyClient.knownServers.list[0].externalAddress, TNLobbyClient.knownServers.list[0].internalAddress);
  3.  

After 10 seconds i have not connected to the server.

tracked it so far to TNTcpProtocol.OnConnect and at this point success is true.

I am not sure after this point as my eyes are starting to go blurry. only been looking at code from either work or this for almost 12 hrs now.

Thanks in advance.
« Last Edit: July 18, 2013, 11:10:18 PM by pyscho2day »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNManager.Connect question
« Reply #4 on: July 19, 2013, 01:38:07 AM »
You need to set up the event delegates. Look at what TNManager does inside its Awake function.

pyscho2day

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 74
    • View Profile
Re: TNManager.Connect question
« Reply #5 on: July 19, 2013, 11:11:29 AM »
Thanks Aren That was what I was missing. Well that and all the stuff that supported them.

I am now able to migrate to another server if one shows up.