8
我在我的Mac的OS X 10.9.Here运行节点服务器上的代码是不能在Mac上从不同的设备访问节点服务器的本地网络
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(3000, '0.0.0.0');
console.log('Server running at http://192.168.1.120:3000/');
我可以在我的Mac访问服务器使用Safari在http://192.168.1.120:3000/
。但是当我用我的iPhone访问服务器时,它失败了。 我的Mac的防火墙已关闭,我的iPhone与Mac使用的是同一WiFi。
Mac上的防火墙是否打开? iPhone真的使用WiFi而不是3G? –
@JoachimIsaksson防火墙关闭,iPhone正在使用WiFi。 –
你确定你的iPhone在你的网络中看到你的Mac吗?您可以使用[Fing](https://itunes.apple.com/en/app/fing-network-scanner/id430921107?mt=8)等应用程序来检查此问题,以便Ping您的Mac。 –