- Home /
Client cannot connect to my local server over internet
I've scoured the internet for a solution to this problem to no avail. My code works within my own network - I am able to host a server and have two clients connect to the server with no problem. However, when I attempt to connect to the server from the internet, it just doesn't work.
I googled my public ip address and checked it with several other sites. I've made sure to enter this ip address properly on the client and then I try to connect on port 25005. My server is, of course, also listening on port 25005 but does not see any available connections.
I tried using Unity's Network.TestConnection code in the docs and the test result is: Limited NAT punchthrough capabilities...
Just to clarify, I have the useNat parameter set when I initialise the server.
I then thought, maybe the connection request is reaching my router through the public ip address, but it's not reaching my computer. So I set up port forwarding so that the inbound port 25005 gets forwarded to my machine's private ip address on port 25005. This has also yielded no results. To verify this, I started my server and used canyouseeme.org to test if my port is open and I get the result: Error: I could not see your service on my public ip address here on port (25005) Reason: Connection timed out
Some sites have told me that I need a static ip address for reliable server hosting but right now I can't seem to even be able to establish a one-time connection. I really have no idea what's going wrong and any help would be much appreciated.
Have you checked for firewall's on both your router(from isp's they can come enabled on your router) and on your machine that has the server setup? You will of course need the port forwarding, but you already did that.
I just went to my router's firewall settings and enabled D$$anonymous$$Z for my machine's ip address. I also turned off my computer's firewall. Unity's Network.TestConnection now reports:
Directly connectable public ip address. NAT punchthrough not needed.
However, open port checking sites such as canyouseee.org still report the same error. Oddly enough, Network.HavePublicAddress() returns false despite Network.TestConnection reporting that I have a directly connectable public ip address.
Okay so despite open port checking sites NOT being able to see my server, external clients CAN connect to my server when I have enabled D$$anonymous$$Z on my machine. However, I've read that this presents a potential vulnerability and would like to know if there are any further workarounds?
Since a connection IS possible, I infer that something in my router must be blocking a necessary port for a connection to be established. I am most certainly listening on port 25005 in my server code...so I'm going to take a guess that my router isn't actually listening on port 25005, which kinda makes sense. Is there any way I can find out what port my router is listening in on to direct stuff from the internet to my machine?
Your answer
Follow this Question
Related Questions
RPC Error function not found 2 Answers
Server Client internet connection 0 Answers
What's an acceptable network send rate? 1 Answer
Unity UDP freezes if disconnected from server 2 Answers
RPC to a single client 1 Answer