Help with Java Applet Design

Hi,

I'm a uni student and I've had some programming experience in Java, although sadly a bit lacking in the area of Java Applets.

Recently I've being involved in a project where some tests are ran a number of times and a Data Aquisition System is used to transfer the number of cycles the test have currently done onto the computer, in a .csv file.

What I would like to do is to make this count available in a web browser LIVE.

I've come up with an idea, which is to write a Java Applet to read this file and output the correct count value in a textbox or what ever, however I am having a bit of difficulty making this update live.

Should I have some sort of script inside the webpage source that re-

runs the applet at regular intervals? If then how would that be possible?

Or should I have the applet re-read the file at regular intervals and repaint it-self? If then there will be problems with timers and possible execution threads (which I don't quite understand yet)?

One thing I want to be careful of is that this file to be read is updated by the DAQ system at random times, so whatever solution is implemented, I wouldn't want the file to be corrupted (e.g. if the file is read and written at the same time).

Thanks for any help

[1304 byte] By [you_zia] at [2007-10-2 7:14:59]
# 1
Cross posted "3" times. Big surprise.
rkippena at 2007-7-16 20:49:16 > top of Java-index,Other Topics,Algorithms...
# 2
Is there a code in this forum that frowns on cross-posting? I believed that they were all within topic.*A bit off topic*Anyway I have solved this problem by using a HTML auto refresh on my applet reader. It was good enough for the purpose at hand.
you_zia at 2007-7-16 20:49:16 > top of Java-index,Other Topics,Algorithms...
# 3

There's no official rule or mechanism that prevents crossposting. As for your question it had little to do with algorithms. If you are going to crosspost, the general unspoken rule is to post the complete question in one place, and post links to it in other forums.

I looked at the other crossposted threads and there were no replies. Perhaps because it is the weekend or perhaps because your question was too general.

I read it as:

I have some data and I want to display it in an HTML page.

rkippena at 2007-7-16 20:49:16 > top of Java-index,Other Topics,Algorithms...
# 4

Thanks.

To rephrase the question, I have some data ( a single value) and I want to display it in an HTML page. However this data is updated by another source at random times (I have no control over this). I would like this data available live, as in when I view the webpage with the applet, I will be able to observe the data change as the file is re-written to.

Algorithmically, I would just like to know the merits of doing this periodic update within the applet itself (i.e. using timerTask()) or just doing a HTML META refresh.

you_zia at 2007-7-16 20:49:16 > top of Java-index,Other Topics,Algorithms...
# 5

There are 3 components

1) application that generates value

2) server

3) client

The client (applet) opens socket to server and waits for data from the server. The application streams data to the server. Upon receiving data the server broadcasts data to the clients.

Classes: Socket, ServerSocket, Applet

rkippena at 2007-7-16 20:49:16 > top of Java-index,Other Topics,Algorithms...
# 6
Cool I'll have a look into those.
you_zia at 2007-7-16 20:49:16 > top of Java-index,Other Topics,Algorithms...