简体   繁体   中英

can't connect to node server from the same wi-fi

Working on React-Native project and something is going wrong. When the node is up, I can connect to it using the IP address 192.xxx:8081/index.js from PC. For development on phone, I need to connect to the same server from iPhone and the server doesn't respond despite when I connect from the same PC it loads immediately. Both phone and PC are connected to the same Wi-Fi. When I use

sudo lsof -i 

I get

COMMAND PID USER  FD  TYPE   DEVICE           SIZE/OFF  NODE NAME

node 5420  user  46u  IPv6 0x.....(corrected this)  0t0  TCP *:sunproxyadmin (LISTEN)

What i get from this message is that somehow, my server is IPv6 type and have IP address - *:sunproxyadmin (am I right?). I don't understand what to do with this and how to achieve loading server from other devices. Help please! May be the issue lies in that I use wrong IP address 192.xxx when starting the server. If that is true where I can find the right one? Should it be equal to Router IP or DNS?

From Mac OS I'm connected with Wi-Fi USB and from iPhone I'm on the same network. There is a difference in Ip addresses displaying at Mac and iPhone. Mac shows 192.xxx03 and iPhone shows 192.xxx01. Router IP and the DNS are the same.

Are you connecting to the server via localhost on your PC? 192.168.0.1? If so, find out the local ip address of your PC and connect to that with your iPhone. Use nginx or something to proxypass to your node server.

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