search

Home  >  Q&A  >  body text

websocket cannot connect

new WebSocket('ws://' 127.0.0.1:843/');can connect

Question 1: Can't connect to a local IP address.

Question 2: Even if the port is changed, the connection will still fail.

Please explain in detail.

nearestnearest2628 days ago1828

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-10-16 10:49:16

    How is the local host configured? Another possibility is to check the firewall configuration

    reply
    0
  • nearest

    Great, Brother Pig, help me. I have disabled the firewall. The hosts file is as follows 127.0.0.1 localhost 127.0.0.1 localhost 127.0.0.1 localhost 127.0.0.1 localhost 127.0.0.1 localhost 127.0.0.1 localhost 172.20.2.60 localhost Everything else is commented with #

    nearest · 2017-10-16 14:35:36
    nearest

    The server can connect normally, but the client cannot connect if it is replaced with a real IP. The client can connect using localhost. When accessed by other computers in the LAN, the connection still fails.

    nearest · 2017-10-16 16:05:44
  • 极世

    极世2017-10-14 12:59:07

    Let’s try restarting the computer, then there’s the configuration problem

    reply
    0
  • Cancelreply