Author Topic: Server breaking when using -tcp and -udp launch parameters.  (Read 3338 times)

Kuliu

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 16
    • View Profile
Server breaking when using -tcp and -udp launch parameters.
« on: November 23, 2015, 06:28:18 PM »
When ever I make a server with -tcp and -udp the server will start correctly and half of my players will be in the game correctly. But on the other hand half of my players are invisible and dont receive most of the RFC's, however they are connected to the server (shown in console). Also these invisible people can drop our items in the world and everyone connected to the server (broken or not) can see the dropped items.

If I start the server with ONLY -tcp all players can connect correctly. Is this an issue with TNet or am I doing something wrong on my end?

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Server breaking when using -tcp and -udp launch parameters.
« Reply #1 on: November 23, 2015, 08:23:57 PM »
What are your launch params for the server?

Example batch script for windows:
  1. @echo off
  2. start "My TNet Server" "TNServer.exe" -name "My TNet Server" -tcp 28001 -udp 28002 -udpLobby 28003
  3.  

And bash for linux:
  1. #!/bin/bash
  2. echo "Starting Server"
  3. mono "TNServer.exe" -name "My TNet Server" -tcp 28001 -udp 28002 -udpLobby 28003
  4. echo "Server has exited"
  5.  

Keep in mind you can't use a port more than once. TcpListener and UdpListener can't share a socket on, say, port 5127 for example. So you'd give 5127 to TcpListener and 5128 to UdpListener.

edit: Make sure you're calling TNManager.StartUDP(int port) on the client after you connect to the server. Good place to do this is the OnNetworkConnect event.
  1. void OnNetworkConnect (bool result, string message)
  2. {
  3.     if (result)
  4.     {
  5.         // Make it possible to use UDP using a random port
  6.         TNManager.StartUDP(Random.Range(10000, 49151));
  7.     }
  8.     else
  9.     {
  10.         Debug.LogError(message);
  11.     }
  12. }
  13.  
« Last Edit: November 23, 2015, 08:40:25 PM by cmifwdll »

Kuliu

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: Server breaking when using -tcp and -udp launch parameters.
« Reply #2 on: November 24, 2015, 11:18:54 AM »
We're doing all of the above. When we only define a single -tcp launch parameter the server will work perfectly fine. But if we define -tcp and -udp launch parameters the server will act like its working fine but we'll get these "ghost" players. they dont have names (defined by the steam api), they are invisible for players connected correctly, but they can interact with the environment and every single client can see these interactions (ie: dropping items, using explosives, etc...). It seems like the RFC's dont go through but TNManager.Create does.

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Server breaking when using -tcp and -udp launch parameters.
« Reply #3 on: November 25, 2015, 12:32:45 AM »
That's a really strange issue. From what you've described the only thing I can think of is you're using tno.SendQuickly for most of your RFCs and UDP is failing (though SendQuickly should fall back to TCP if UDP is unavailable...). TNManager.Create uses TCP so that explains why some actions work for these invisible clients.

I would check to see if your port for UDP is opened (both the server port and the invisible client's port). You can find web-based port scanners online. It's still really strange that it's not falling back to TCP. Maybe you've got some insane packet loss when using UDP?

I'd load up wireshark and inspect packet flow. I'd also set up some breakpoints in your project and step through the important bits.

That's all the help I can provide without more info. Good luck! :) I'll check back periodically for updates.

decerto

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: Server breaking when using -tcp and -udp launch parameters.
« Reply #4 on: November 25, 2015, 12:06:20 PM »
That's actually a good point. I'll change the RFC's to tno.Send and not tno.SendQuickly and let you know.

Thanks!

decerto

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: Server breaking when using -tcp and -udp launch parameters.
« Reply #5 on: November 25, 2015, 06:15:57 PM »
Okay. I've moved all tno.SendQuickly to tno.Send and it works perfectly. It looks like some people have issues with UDP resulting in broken RFC's. I'll be no longer using tno.SendQuickly.

It confusing at first because all the developer PC's and tester PC's worked fine. So we didn't know what the issue was.

The only reason why we wanted UDP was to ping the server on the server list. Now we have ping and players no longer break.

Thanks a lot dude.