Pryaxis / TShock

☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
GNU General Public License v3.0
2.41k stars 377 forks source link

TShock's automatic port-forwarding doesn't work #1387

Closed OnsenManju closed 7 years ago

OnsenManju commented 7 years ago

(TShock current release 4.3.22) If answer "y" to "Automatically forward port? (y/n)" at startup, stock (vanilla) server registers its port mapping to UPnP-enabled router after loading the world, but TShock doesn't.

(Maybe it multicasts to 239.255.255.250 beforehand in order to discover the router, but that's too noisy because other applications also do the same way)

If TShock disables this feature intensionally, it would be better to hide such an option. (related: the forum post)

hakusaro commented 7 years ago

Does this work on Vanilla Linux servers through mono?

OnsenManju commented 7 years ago

Hmm, vanilla server's port forwarding doesn't work on Linux. During the server was running, no SSDP packet regarding Terraria seemed being sent.

On Linux, I'm using GOG version of Terraria and launched it as follows: ~/GOG Games/Terraria/game$ ./TerrariaServer -x64 It looks like vanilla server uses MonoKickstart to run, but I'm not sure what version of Mono is used (4.0?).

BTW, TShock on Mono 4.8.0/Linux had the same result as Windows.

OnsenManju commented 7 years ago

? Did you mean running Windows binary on Linux by using Mono?

Edit: I can't launch because it invokes the unmanaged dll (Kernel32).

/tmp$ mono TerrariaServer.exe

Unhandled Exception:
System.DllNotFoundException: Kernel32
  at (wrapper managed-to-native) Terraria.WindowsLaunch:SetConsoleCtrlHandler (Terraria.WindowsLaunch/HandlerRoutine,bool)
  at Terraria.WindowsLaunch.Main (System.String[] args) [0x00038] in <c7ed7f12dbd942c5b3e57642f0f95b55>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: Kernel32
  at (wrapper managed-to-native) Terraria.WindowsLaunch:SetConsoleCtrlHandler (Terraria.WindowsLaunch/HandlerRoutine,bool)
  at Terraria.WindowsLaunch.Main (System.String[] args) [0x00038] in <c7ed7f12dbd942c5b3e57642f0f95b55>:0
hakusaro commented 7 years ago

If it doesn't work in the Linux Terraria server, I don't think we'll be investigating fixing or implementing this functionality. There is definitely a UPnP plugin on the forums.