简体   繁体   中英

Why does python SimpleHTTPServer not work on localhost when there is no internet?

I ran python -m SimpleHTTPServer to create a web server session (on Windows 8). This works fine using http://127.0.0.1:8000 or http://localhost:8000 UNLESS there is no internet connection. When there is no internet the (Chrome) browser stays blank. How to make the local server work regardless of whether there is external internet connectivity? Is this a Windows specific issue?

If this is what I think it is, you're testing by unplugging the network cable or turning off your wireless card.

When there is no network, in many Windows versions, the entire network stack, or at least the user space part of it, goes away.

You might hunt up a loopback adapter pseudo net card and install that, which will give you an always active network connection; I believe Microsoft did make one available for Windows 7 and earlier, but I haven't looked for it on Windows 8.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM