Oct 7, 2015 at 2:40 AM
Join Date: Aug 24, 2013
Location: 0xDEADBEEF
Posts: 211
Pronouns: she/her
Ah, makes sense.Which reminds me, when I sent you the networking example server/client, there had been a problem with the port-forwarding since my laptop had changed its port by a bit. The ports were only port-forwarded to specific ip addresses.
You can implement hole punching into your games as well (so that players don't have to port forward). I haven't set it up fully and I might be missing something, but here's how it goes:
M = Master server with public IP | S = player-hosted server behind firewall | C = client behind firewall
All three must use the same port number, so if M is public on port 7777 (for example), then S and C will talk on 7777
-This is so that the port that M grabs is the proper public port (routers have Port Address Translation, so the port it grabs won't be 7777, it'll be something else made by the router, but everything is still connected and routed properly)
When S is created, S talks to M, which stores the IP address and port that it gets
C wants to connect to S, so it talks to M for S's IP and port
M sends C IP and port of S
C connects/sends data (depending on TCP vs UDP) to S
M is no longer needed until another S is made or another C wants to connect
The only connections that would exist (only if you're using TCP) would be between C and S, so M is not connected to anything, it just uses UDP