Hey. I would like to deal with one very exciting problem for me. I wrote a simple node.js script:

var http = require("http"); http.createServer(function(req, res){ res.end("server is running!"); }).listen(8080); 

Well, the server accepts requests on port 8080 and from the local address in the browser everything is displayed as needed. But what if I want my friend to connect to this simple server? I determined my network ip, not local, but when I connect to it, no answer follows, I drive 192.168.0.105:8080 and everything works for me, but not with friends, then I drive 141.138.104.72:8080 (network address), but Does not work for me or for friends. Can you please tell me what else needs to be done so that people can connect to this small server? What is missing?

    1 answer 1

    First: Is the IP address you specified static? If not, the next time you reconnect to the Internet address will be invalid
    Secondly: 192.168.0.105:8080 - the address in the local network. In order to gain access to a computer at this address from the outside, you need to configure port forwarding on your router (if it exists), configure the firewall (open the required port) again, if it exists.
    There may be another problem - the provider can close these ports. In this case, proxying can help.
    To be honest, this is not the easiest thing for a person who does not understand networks at all. I would start by configuring the router (if available) and checking the availability of the port.
    PS If there is a router after all, Dynamic DNS services can solve the problem of dynamic IP. In the settings of the router, you can search for supported services and register the name.

    • You're right. In the settings TP-LINK says that dynamic. Do I have to dig in the settings? What does porting mean? Do I need the router to redirect requests for the port specified in the code to my computer? - Muller
    • @Muller TP_LINK has it called Виртуальные серверы , as far as I remember. There you can specify the incoming port from the outside (for example, 80), the IP address inside the local network (in your case 192.168.0.105) and the internal port (8080). Thus, requests to the router will be forwarded from port 80 (standard HTTP) to port 8080 of your computer. TP_LINK also has DDNS. At least such a system works fine for me. - Andrew Paramoshkin
    • Excellent. Thank you very much. That is, I only create Wirth. server and register DDNS with one of the providers? And all? - Muller
    • @Muller in general, yes, it will be enough for the beginning - Andrew Paramoshkin
    • Thanks again - Muller