问题
Is it possible to initiate a TCP connection from a browser?
If so, does there already exist browser (esp. Firefox and Chrome) extensions that do this? If no extensions exist yet, do you know the core elements/functions to create a Firefox/Chrome browser-initiated TCP connection?
回答1:
The Chrome Browser (I think since v24 in the stable channel) lets you host a TCP server, and the samples indicate that it can connect to a telnet server, which means that it is also capable of being a TCP client.
https://github.com/GoogleChrome/chrome-app-samples/tree/master/tcpserver
https://github.com/GoogleChrome/chrome-app-samples/tree/master/telnet
But these are not standardized, so, if you can work with websockets, do prefer that.
http://developer.chrome.com/apps/socket.html
回答2:
There are Websockets, but they are limited to the websocket protocol outlined at in RFC 6455.
So far, most modern webbrowsers support it
来源:https://stackoverflow.com/questions/15589990/initiate-tcp-connection-from-a-browser-extension