aspose file tools*
The moose likes Applets and the fly likes Applet games, stock streamer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet games, stock streamer" Watch "Applet games, stock streamer" New topic
Author

Applet games, stock streamer

Victor Ho
Ranch Hand

Joined: Sep 05, 2003
Posts: 74
Hi,

Does anybody know how the typical applet games, stock streams work across firewalls?

I am assuming the applets must be connecting to the back-end servers through HTTP. But since it is only the applet who can make requests to the server (not the other way round), is the applet limited to polling the server for events/updated data? This does not seem a viable solution if the events need to be real-time.

Any idea how this problem is solved?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8900
    
    8

Firewalls are usually one-way. They prevent incoming connections, not outgoing. The applet is free to connect back to it's originating server using whatever protocol it desires.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Victor Ho
Ranch Hand

Joined: Sep 05, 2003
Posts: 74
Originally posted by Joe Ess:
Firewalls are usually one-way. They prevent incoming connections, not outgoing. The applet is free to connect back to it's originating server using whatever protocol it desires.


But if we were to consider for a generic solution, any idea how it is done? For example, my company's firewall only allows outgoing HTTP traffic but I am still able to access stock streamers like Datek's/AmeriTrade's.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8900
    
    8

Install a firewall like Zone Labs Zone Alarm which will alert you to outgoing connections. That will let you know what the streamer is up to. Since free stock tickers aren't intended to compete with professional trader's stock feeds it may be that it simply polls some web server every few minutes.
When you say that the firewall blocks everything but outgoing HTTP, do you mean that it blocks every outgoing request that isn't going to a remote port 80 (standard HTTP port)? Can you use HTTPS (port 443) FTP (21) or SSH (22)? If the firewall allows any of these connections to be made all one would have to do is have their web server offer the custom service on that port rather than the standard service.
You could also digitally sign the applet and have it download from one server's port 80 via HTTP and connect back to another server's port 80 via your application's custom protocol for updates.
Victor Ho
Ranch Hand

Joined: Sep 05, 2003
Posts: 74
Originally posted by Joe Ess:
When you say that the firewall blocks everything but outgoing HTTP, do you mean that it blocks every outgoing request that isn't going to a remote port 80 (standard HTTP port)? Can you use HTTPS (port 443) FTP (21) or SSH (22)? If the firewall allows any of these connections to be made all one would have to do is have their web server offer the custom service on that port rather than the standard service.

My company's firewall blocks outgoing FTP, SSH and only allows HTTP/S through proxy.

Originally posted by Joe Ess:
You could also digitally sign the applet and have it download from one server's port 80 via HTTP and connect back to another server's port 80 via your application's custom protocol for updates.

Maybe I misunderstood you here, but if my firewall only allows HTTP/S (either incoming/outgoing), the applet still needs to poll the server right?
I am trying to find a solution that the server can push real-time events to the applet with my setup.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8900
    
    8

Originally posted by Victor Ho:

Maybe I misunderstood you here, but if my firewall only allows HTTP/S (either incoming/outgoing), the applet still needs to poll the server right?


That depends on HOW it is blocking the traffic. If it is blocking it by port number, like the Linux kernel firewall, iptable, does, you can send non-HTTP traffic to a server with that port and use any protocol you want. You will have to do some research on your company's firewall setup and write some tests to see what your options are.
Another option to think about is to have a servlet take a client HTTP request and hold onto it until something interesting happens, then respond to it. It isn't quite client-server, but it's better than polling.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Applet games, stock streamer