Make my http server public

Sep 9, 2018 at 9:25pm
Hello. Im trying to get my server online. The server works on localhost, but I can't make it work online/public.

I been in my "port forwarding-settings" in my routerconfig. There I've added my IPv4-adress + the port(27016) that the server listens to.

Then I tried to visit my page with the ipadress from whatismyipaddress.com.

I put this in the adressbar: "myipadressfromthatwebsite:27016"

Getting no results. Any ideas?
Sep 10, 2018 at 4:13am
There's a number of things that need to go right in order for this to work:
1. Is your process listening on localhost? A process listening on localhost will only receive connections from localhost. To receive connections from outside it must listen on 0.0.0.0 (or the IPv6 equivalent) or on the IP of the network interface that's connected to the correct network.
2. Is the firewall on the computer running the process filtering the port?
(If points #1 and #2 check out, other computers on your local network should be able to connect to your process.)
3. You've already configured port forwarding on your router, so I'll assume you've done that correctly.
4. Is the firewall on your router filtering the port?
(If points 1 through 4 check out, when you connect a computer to the WAN port of your router, it should be able to connect to your process, assuming your network doesn't go haywire.)
5. Did you try to connect to your process using your public IP address from inside your own network or from outside. Some networks have problems doing loopback routing, so you should attempt the connection from an outside computer. For example, you could rent a VPS for a couple hours to run the test.
6. Is your ISP applying NAT or otherwise filtering incoming connection requests? If it is, you will simply never be able to accept connections from the Internet.
Sep 10, 2018 at 11:33am
I had it set on 127.0.0.1. I have changed it now to 0.0.0.0. The port is set to 27016. However, it still don’t work. I removed the windows firewall for a few seconds and gave it a try, it didn’t help either. (I should also mention that I visited my address from a mobile device. If it matters)
Sep 10, 2018 at 3:59pm
volang, but which part of what helios said doesn't work?
Have you tried connecting to your website using the local address from another computer inside your LAN? And then did you try connecting to the WAN port of your router and using the WAN-side IP?
You should first test with helios's first set of parentheses, then attempt his 2nd set of parentheses.
Sep 10, 2018 at 4:47pm
sockaddr_in settings;

SOCKET server_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

settings.sin_family = AF_INET;
settings.sin_addr.s_addr = inet_addr("0.0.0.0");
settings.sin_port = htons(27016);

bind(server_socket, (SOCKADDR *) &settings, sizeof(settings) );
listen(server_socket, SOMAXCONN);


1.No
2.Not sure, but I tried without the firewall being on
3.These are my port forwarding settings: Enabled, Port Range: 27016, Protocol: TCP, Local IP: 192.168.1.2, Local Port: 27016
4.Firewall is disabled on router.
5. Both
6. Waiting for answer.

Other computers in my network and myself can connect to the server with the IPv4-address (192.168.1.2:27016), but not from the public address.

I dont now if this matters, but my WAN-IP, is not the same as the IP from the pages I find when I search for "myip" on google for example.
Sep 10, 2018 at 4:55pm
I dont now if this matters, but my WAN-IP, is not the same as the IP from the pages I find when I search for "myip" on google for example.
Then it's likely that your ISP is applying NAT. Your router is not directly connected to the Internet, it's connected to your ISP's network, and you're sharing a single public IP address with all your ISP's subscribers. You will not be able to receive connection requests from the Internet using that ISP.
Sep 10, 2018 at 9:02pm
Allright. Thanks all. It's appreciated as usual
Topic archived. No new replies allowed.