I am creating a multiplayer game using Unity Game Engine. I created my server using Socket in C#.
My server works fine on the LAN, however it doesn't work on the WAN. I learned that I need to configure port forwarding in order to make it work on the WAN. I am using a Tp-Link router, and I found a great video that helped me to setup port forwarding:
https://www.youtube.com/watch?v=2tIUts0fyFk
Things I adjusted on my own:
- In the video, the person used HTTP, but I chose DNS for my Socket server. I don't really know what I should choose here.
- On the client side, I changed the server IP from the IP reported by
ipconfig
to my router's static IP, and the server port to the port I chose while setting up port forwarding.
- On the server side, I put the IP reported by
ipconfig
as the server IP. This is the same IP I chose as my DHCP OPTION.
I am using the UDP protocol for my game, and as I said it is working fine in my LAN network.
My problem is, even after all this, my game is not working on the WAN. I also made sure that my WAN client has his Windows Defender firewall turned off. It didn't work.