我使用Windows 10,并且想在我的公共地址中的端口3000上运行nodejs(仅对我个人和用于远程调试)。
因此,我说by this answer打开端口,然后从expressjs运行此代码
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => res.send('Hello World!'))
app.listen(port, () => console.log(`Example app listening on port ${port}!`))
然后我得到myip address,并告诉我的朋友在他的Chrome浏览器中打开http://256.266.266.266:3000/
。
但是答案是This site can’t be reached
ERR_CONNECTION_TIMED_OUT
。为什么?如何在公共IP中连接到我的nodejs应用程序?
据我所知,我没有任何防病毒软件或防火墙。
Telnet telnet 256.266.266.266 3000
说.Could not open connection to the host, on port...
netstat -an | find "3000"
说TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING