开发者

Listening for TCP connections through a browser

开发者 https://www.devze.com 2022-12-16 16:52 出处:网络
开发者_如何学PythonIs there some sort of method I could use to launch something from a browser which would listen for tcp connections?I explored Silverlight but it looks like I can only connect to 3rd
开发者_如何学Python

Is there some sort of method I could use to launch something from a browser which would listen for tcp connections? I explored Silverlight but it looks like I can only connect to 3rd parties with a Silverlight app. What I'm looking for is have the user run something in browser which could receive third party connections. I'm starting to think it has to much potential for abuse so it's not allowed, but I'm hoping I'm overlooking something.


In general, the popular approach for simulating a browser listening to connections, is to listen for them on a server, and then use comet, long-polling, reverse AJAX or a similar technique to "push" the messages from the server to the browser.

This way you stay within all the rules and limits, and you'll be doing something that has been tried and tested for long. It will even work through firewalls, since technically it is still the browser initiating the connection with the server.

Obviously this is not the same as listing to the TCP connections, but it may be an option for you to consider.


If I understand what you are looking for, I think a java applet would be able to do this. The user would navigate to a page with the applet present, then (assuming they "trusted" the applet) it would be able to listen for a TCP connection.

Your only issue may be a firewall on the user's machine.

(I am assuming you need the this process to be run locally, otherwise a server-side approach would be better)


You want a websocket: http://blog.chromium.org/2009/12/web-sockets-now-available-in-google.html

Firefox also has them.


You could likely do something with Flash XML Sockets.

That said, if you need raw TCP then this isn't for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消