Remote clients can no longer connect with new modem / router
Hi,
PROBLEM: I have a unity networking game that I got working twice in two locations without changing the game code. I've recently moved once again and am using a new router and the game will not connect remote clients, only local clients using localhost or the servers internal ip address as the Network Address.
Dynamic DNS: I'm using No-IP for my dynamic DNS and have ensured that is working properly and updating my external IP address. The address for No-IP is what I place in the Network Address field (mmoerpg.ddns.net in this case.)
Port Forwarding: I went in to my router and forward the port that the game uses which is 4444 allowing both TCP and UDP connections to the internal IP address of my server which was set to static. Still, when I try to connect a remote client using these settings, it does not connect although it used to connect using these same settings.
Test Port Forwarding: I began to think it was the new router (I would use my old router for trouble shooting but the new router is modem/router combo and is designed for DSL whereas my old modem is for Cable.) To test that the router had in fact forward the ports correctly, I went to www.portchecktool.com and test port 4444. First, it said that the connection was timing out. I tried disabling the firewall on my server and tried again. This time it, much more quickly, it said Connection refused. I then tried running the game on the server with the firewall disabled and still, the port check tool said Connection refused.
Check For Listened Port w/ netstat -a: So it now seemed that the port was forwarded properly as it was trying to get into my server but the server was refusing it. The next thing I checked was whether my game was actually listening on the right port after starting and that that port wasn't already being used by another program for some reason. I opened cmd with admin rights and used the netstat -a command which shows all ports currently being listened to. Port 4444 was not on the list. Great, nothing is using the port. I launch the game and start server then check netstat -a again. This time it shows two UDP instances listening to port 4444. What is strange is that the prefix for the port is not my servers internal IP address which I thought it should be but then again I don't really know. The prefix for one was 0.0.0.0:4444 and the other was [::]:4444. Could this be my problem? or is this normal when a program is listening on a UDP port.
Here is a link to a forum post with pictures: https://forum.unity3d.com/threads/remote-clients-can-no-longer-connect-with-new-modem-router.443153/
This was post by Bunny83 on another thread that I had improperly post this question to. Thank you Bunny83.
0.0.0.0:4444 is correct. "0.0.0.0" is the local binding address for the socket. As you might know IP communication uses IP addresses inside of a packet to specify the target location. In order to receive packets one has to "open" a port first. In addition to specifying the port you can also specify what local address you want to bind to. That means only packets which are sent at that specific IP address are actually received. One computer / peer can own multiple IP addresses at the same time. You usually have a local network address as well as the local loopback address which however is only valid within your own system. The address 0.0.0.0 is a special address which simply means "all addresses". So there's no restriction which the actual target IP is, you will get any packet on that port that arrives at your NIC.
Note: some routers have their own firewalls built-in so make sure you check that. Also keep in $$anonymous$$d when you forward ports to choose the right protocol. When in doubt you can forward both (TCP and UDP).
Some other routers (i have such a crap :|) don't allow local loopbacks on the public IP of the router, That means the whole world can connect to your router, except you how sits behind this router. All routers i had before had no problems going out and co$$anonymous$$g straight back in using the public IP. However if you use an external site to test the connectivity that shouldn't be the problem.
I suggest you install a packet monitoring software on your server (something like WireShark) to see if you receive anything. You can do the same on your client to see what goes out and what comes back. If you get a connection refused you should receive an IC$$anonymous$$P message with "delivery failure".
Your answer
Follow this Question
Related Questions
UNET NavMeshAgent Sync Target Transform 0 Answers
How To Sync Lights So The Other Client Can See The Current State Of the light 0 Answers
multiplayer game -how to connect each game-object to specific network player 0 Answers
API for multiplayer game with authoritative server? 1 Answer
How to allow All clients to move blocks? 0 Answers