Author Topic: Multiple servers on the same LAN [mobile]  (Read 1620 times)

IZLogic

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 8
    • View Profile
    • IZLogic!
Multiple servers on the same LAN [mobile]
« on: July 07, 2014, 12:36:50 PM »
Hello,
I'm trying to make a wi-fi LAN game for mobile.
Basically what I'm trying to do is :
- The user can decide to play the game alone or versus other players connected to the same LAN.
- If the user choose to play alone, I start a local gameserver on his device visible to other players.
- The other users now can connect to his server and play against him.

So the idea behind is that each player that is playing alone is a game server to join for other players.

All is working good if I've have only 1 server at a time. I can connect to the server and play and all, but if I have 2 different servers on 2 different devices the TNLobbyClient.knownServer list always returns me 1.
The strange thing is that in the log I can see for just a fraction of time one server than the other and so on. Seems they are fighting for the single element that the TNLobbyClient.knownServer list returns.

Also if I try to start servers from your menu sample on multiple devices only one get showed in the list.
Did you have any suggestion on how to start multiple game servers on the LAN and be correctly discovered by all the players in the network?
If the problem is that there's multiple LobbyServer in the net, how can I make it unique for all the players connected to the LAN?

Edit: I want to add another problem I'm facing.
Very often on iOS when I'm creating the local server the TNet.Tools.localAddress and also the internalAddress are 255.255.255.255. When I try to connect to the created server the OnNetworkConnect throw a Connection refused message.
I know there was trouble few months ago about localAddress on ios, is it still there?
I'm using TNet 1.9.5c .
Thanks for the support.
« Last Edit: July 07, 2014, 01:20:37 PM by IZLogic »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Multiple servers on the same LAN [mobile]
« Reply #1 on: July 08, 2014, 04:23:49 PM »
Remove list.Clear(); from line 194 of TNServerList.cs. It shouldn't be there.

As for the 255 thing -- I would be very curious to know how that happens as I've never seen or been able to reproduce it...