Author Topic: TNetServer and gateway  (Read 6996 times)

ciaravoh

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
TNetServer and gateway
« on: February 24, 2014, 02:47:00 PM »
Hello All,

I cannot get the TNServer.exe running on either Windows or OSX. the gateway is not found.

On windows, firewall is disabled.
on OSX, no firewall at all.

Any clue ?

thank you.

Hervé

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNetServer and gateway
« Reply #1 on: February 24, 2014, 05:12:46 PM »
It's only used to open ports. If you have no gateway / firewall, then there is nothing to open ports on, and the message is completely harmless.

ciaravoh

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: TNetServer and gateway
« Reply #2 on: February 24, 2014, 05:20:16 PM »
ok good. But I can't get my project run. Network connection seems to work but I can't get the notification when a new player join the channel. Is there a reason for that ?

to be more specific, the OnNetworkPlayerJoin notification is not triggered when a second player join.

I issue a TNManager.JoinRandomChannel(null, false, 2, null); to launch the game with 2 players.
« Last Edit: February 24, 2014, 05:30:08 PM by ciaravoh »

ekilog

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: TNetServer and gateway
« Reply #3 on: February 25, 2014, 02:27:44 AM »
just for your information, using TNManager.JoinChannel(0, null), it works.
It look like the joinRandomChannel is not connecting players ?
Your help is appreciated.
regards,
« Last Edit: February 25, 2014, 02:37:28 AM by ekilog »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNetServer and gateway
« Reply #4 on: February 25, 2014, 03:19:55 PM »
JoinRandomChannel passes '-2' for the channel ID, which is interpreted as "any open channel" by TNet.GameServer (line 815).

Whether the join request succeeds or fails, you always get OnNetworkJoinChannel back. This notification is sent to the player who is attempting to join. Other players get a different notification -- OnNetworkPlayerJoin.

ekilog

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: TNetServer and gateway
« Reply #5 on: February 26, 2014, 02:44:30 AM »
JoinRandomChannel passes '-2' for the channel ID, which is interpreted as "any open channel" by TNet.GameServer (line 815).

Whether the join request succeeds or fails, you always get OnNetworkJoinChannel back. This notification is sent to the player who is attempting to join. Other players get a different notification -- OnNetworkPlayerJoin.

Hi,

Thank you for your answer. I probably miss something here. My game is a turn by turn game with 2 players. Should I use JoinRandomChannel or Joinchannel with a static channel number (alway 1 for example). How can I make sure that a channel with 1 player will be filled by the next requester ?

Thank you again.

Hervé

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNetServer and gateway
« Reply #6 on: February 26, 2014, 04:05:10 PM »
You should generally get a list of channels from the server first, and let the player choose which to join, or create a new game. If you're doing a quick match game and all channels are guaranteed to be your game instances, then joining a random channel is fine. I'd generally advise you to pass a level name though.

ekilog

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: TNetServer and gateway
« Reply #7 on: February 27, 2014, 03:23:21 AM »
You should generally get a list of channels from the server first, and let the player choose which to join, or create a new game. If you're doing a quick match game and all channels are guaranteed to be your game instances, then joining a random channel is fine. I'd generally advise you to pass a level name though.

I'm looping here...

I want to reproduce the GameCenter behavior.

1st player create a game (create a channel with player limit = 2)
2nd player join the game

3rd player create a game (create a channel with player limit = 2)
etc...

But :

- When the first channel is created, it does not appear in the Channel List (except if the channel is created with JoinChannel() )
- when the first channel is created with JoinRandomChannel, the 2 first players did not see each other.

I'm not sure how to use the JoinRandomChannel.

Any help is appreciated.

regards

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNetServer and gateway
« Reply #8 on: February 27, 2014, 07:09:00 PM »
Is the channel marked as closed? The channel list response is this:
  1.                         case Packet.RequestChannelList:
  2.                         {
  3.                                 BinaryWriter writer = BeginSend(Packet.ResponseChannelList);
  4.  
  5.                                 int count = 0;
  6.                                 for (int i = 0; i < mChannels.size; ++i)
  7.                                         if (!mChannels[i].closed) ++count;
  8.  
  9.                                 writer.Write(count);
  10.  
  11.                                 for (int i = 0; i < mChannels.size; ++i)
  12.                                 {
  13.                                         Channel ch = mChannels[i];
  14.  
  15.                                         if (!ch.closed)
  16.                                         {
  17.                                                 writer.Write(ch.id);
  18.                                                 writer.Write((ushort)ch.players.size);
  19.                                                 writer.Write(ch.playerLimit);
  20.                                                 writer.Write(!string.IsNullOrEmpty(ch.password));
  21.                                                 writer.Write(ch.persistent);
  22.                                                 writer.Write(ch.level);
  23.                                                 writer.Write(ch.data);
  24.                                         }
  25.                                 }
  26.                                 EndSend(true, player);
  27.                                 break;
  28.                         }
It ignores channels that are marked as closed. I don't see any reason why the channel wouldn't show up on the list if you used the JoinRandomChannel vs JoinChannel, as I mentioned JoinRandom function simply calls the other one inside. How are you retrieving your channel list?