Listening for TCP connections through a browser
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.
精彩评论