1

I have a problem I want to use socket to connect to whois servers through port 43, but it seems it's not possible or I'm doing it wrong. I've tested socketio and jsXMLsocket, but no luck.

With PHP is easy to do it by using fsockopen('whois.crsnit.net',43); Then fputs with domain name and fgets to retrieve the result from the whois server. But I want the whois lookup to be possible at browser side, so that the server is not that much under load.

Is it possible to do it? If so, can you include some code snippet?

Thanks.

Martin Šajna
  • 123
  • 2
  • 8
  • No, it's not possible to open a raw socket connection from JS (even WebSockets wouldn't work for this). – James M Mar 22 '12 at 12:38

2 Answers2

1

JavaScript can only send HTTP requests and make WebSocket connections. If you can run a small server, you could use a server-side WebSocket-to-TCP proxy using websockify.

It's also possible to use Flash or a trusted Java applet for this, but JavaScript alone can't do it. Sorry.

apsillers
  • 112,806
  • 17
  • 235
  • 239
0

jsXMLsocket use a swf (flash) file in background for open a socket connection. Unfortunately, for security reasons, in Flash Player 9.0 and later, the target host must serve a socket policy file. No policy file, no connection.

Luca Rainone
  • 16,138
  • 2
  • 38
  • 52