Home>

Read this site and implement the API in Python Did.
API.py was created as shown on this site, and if it washost = '0.0.0.0'locally, it worked fine.

I wanted to develop this and build a server on a lab machine, but it doesn't connect well.

Why can't I connect even though the port is properly released?
By the way, the port looks like this now.
When I tried online port check test, 80 and 22 were accessible, but 2112 was not accessible ... Is n’t it open properly?

  • Answer # 1

    Assume that the client and server are in the same LAN.<--- Very important
    If you are not in the same LAN, you need to configure NAT.

    Step 1. Server side Check the IP address with the

    ifconfigcommand.

    $ifconfig
    Step 2. Client side Confirm that

    pingpasses. Suppose the server IP address is192.168.11.3.

    $ping 192.168.11.3
    Step 3. Server side Replace

    hostwith the confirmed IP address.

    if __name__ == '__main__':
        # api.run (host = '0.0.0.0', port = 3001)<--- It was confirmed that this does not communicate.
        api.run (host = '192.168.11.3', port = 3001)
    Step 4. Client side

    This should be accessible via a browser.

    Supplement 1

    It may be easy to understand if you hit a book or hit a book with the keywords subnet mask, WAN, and LAN.

      

    Subnet mask
      Computers and servers on the same network can communicate easily. On the other hand, computers and servers that do not have the same network must use a router or network device (such as L3) to switch networks for communication.

    Supplement 2

    By the way ...

      

    0.0.0.0-Wikipedia
      In IPv4, 0.0.0.0 is an IP address in which all bits are 0, and is a non-routable metaaddress used to specify invalid, unknown, or non-applicable targets. This address is assigned some special meaning.

    Supplement 3

    When you start Flask, you will see the text "WARNING: This is a development server. Do not use it in a production deployment."

    $python hello.py
     * Serving Flask app "sample" (lazy loading)
     * Environment: production
       WARNING: This is a development server.Do not use it in a production deployment.
       Use a production WSGI server instead.
     * Debug mode: off
     * Running on http://192.168.11.5:5000/ (Press CTRL + C to quit)

    I don't know if it's a security issue or a performance issue, but I don't think it should be published on the WAN. I think it's probably a performance issue ...

      

    Information
      The development server is not intended to be used on production systems.It was designedespecially for development purposes and performs poorly under high load.For deployment setups have a look at the Application Deployment pages.
      Serving WSGI Applications