wood burning stoves 2.0*
The moose likes Applets and the fly likes Can I make an applet act as a server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Can I make an applet act as a server" Watch "Can I make an applet act as a server" New topic
Author

Can I make an applet act as a server

Ritu Kama
Ranch Hand

Joined: Sep 10, 2001
Posts: 72
Hi,
I want to be able to update my web page with data coming every second from some server over HTTP post.
Currently I have a listener program that is recieving data constantly. But can I make an applet that acts as listener on a particular port and recieves data over HTTP Post. This way I can update my web page in dynamically in real time.
Thanks
Ritu
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Ritukama,
Before you catch some heat from one of the bartenders or sheriffs around here, you need to change your display name to a first and last name.
Now, as you know, under most circumstances, an applet runs in the "sandbox". Unless the local machine has a policy file in place for the applet's codebase (or signed certificate) granting extra privaleges, then the applet can only access ports (and other resources as well) on the machine that it originated on (the codebase.)
I'm not totally clear on what you are trying to do, but most likely the answer to your question is no you can't listen on ports from an applet without explicit permission being granted.
Hope this helps
Michael Morris
SCJP2
[ April 02, 2002: Message edited by: Michael Morris ]

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Ritu Kama
Ranch Hand

Joined: Sep 10, 2001
Posts: 72
Hi Michael,
I fixed the name problem - thanks for reminding me. I got the idea that applets cannot access resources outside the codebase.
What I am trying to do is as follows:
I have a server that is sending some data (in XML format) over HTTP post and I need to be able to display the data in real time in a browser.
I was looking for a way to implement this without having to refresh my web page over and over again.
Do you have any idea?
Thanks
Ritu
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Ritu,
If your web server supports JSP and servlets, that's probably your best option. I have very limited experience in those areas so I would suggest you post this on the JSP and/or servlets forums here at JavaRanch.
Hope this helps
Michael Morris
SCJP2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I make an applet act as a server