0

I want to give the client his gateway address, I have a bunch of common gateway ips in a list.

How can I connect to an IP like '192.168.1.1' through javascript and see if it gives a response or not.

It would be better if the code doesn't use any third party framework.

  • This is an old thread but perhaps useful https://stackoverflow.com/questions/12407778/connecting-to-tcp-socket-from-browser-using-javascript – mplungjan Feb 15 '21 at 14:08
  • Hey, I found out that I could use websockets to achieve this https://developer.mozilla.org/en-US/docs/Web/API/WebSocket . Thanks for your help. –  Feb 16 '21 at 08:39
  • You cant simple "Connect" to "192.168.1.1" unless you have a port number handy. Once you have port number you can try "telnetting" on the port by using xmlhttprequest. – Mukesh Verma Feb 21 '21 at 19:36
  • yes it's port 80 –  Feb 21 '21 at 20:08

0 Answers0