[Flask] Can ping the server, but can't access the Flask app

CCP Dragonedge ccp at drsb.com.my
Thu Jul 16 23:00:59 EDT 2020


Hi,

What I want to do is to grab the IP address of the client. In my Flask
code, after the user logs in, I just do the following in my app's menu page:

{{ request.remote_addr }}

To test, I set up two Windows boxes at home. One is running Windows 7, the
other running Windows 10. The Win10 box contains the Flask server. It runs
on my home network (connects through wifi). When I go to
http://api.ipify.org to get the public IP address, it returns
174.141.xxx.xxx.

So, I connected the Win7 box through my phone's hotspot (i.e. using a
different network). I then go to ipify to get this box's current public
address, and get something like 115.164.xxx.xxx.

When I ping 174.141.xxx.xxx (ie the Win10 box) from the Win7 box, no
problems. But when I ping 115.164.xxx.xxx (ie the Win7 box) from the Win10
box, all packets are lost.

For the purposes of my tests, I think this is weird, but not a big deal. My
Flask server sits on the Win10 box, and the Win7 box can see it, so I
should be able to test, right?

So, on the Win10 box, I start up the server like so:

flask run --host=0.0.0.0

The server starts up without any problems (says it's running on 0.0.0.0:5000
).

Then, I go to my Win7 box, open up a browser, and type:

http://174.141.xxx.xxx:5000

But can't see the site! Specifically, the error message says:

"resource (174.141.xxx.xxx) is online but isn't responding to connection
attempts"

Proxy settings on the client are off, and I'm pretty sure there aren't any
add-ons on the browser.

Anyone have any idea what's going on? Why can I ping the server, but not
access the Flask app?

I know this question isn't specific to Flask, but I've been looking at the
answer for the last day or so, and don't know where else to look. I'm also
totally clueless when it comes to network stuff (as this question shows).

Any help is much appreciated.

Thanks,
p
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20200717/39164993/attachment.html>


More information about the Flask mailing list