PDA

View Full Version : Java periodically polling (checking) a file?



hagen00
March 8th, 2006, 07:06 PM
This question has to directly do with this thread over here..
http://ubuntuforums.org/showthread.php?t=141096, where i was given the advice of using sockets. Now i've gotten a simple client server app working using sockets, but to do what i really want to do will require a lot more work!

So a simple solution would be for me to have java periodically checking a file to see whether either it contains no value, it contains a 1, or it contains a 0. If empty, i would have java wait a second or so before checking the file again (maybe until a max of 2 minutes). I know it's extremely un-elegant, but in your opinions, is this an option? How much processing overhead would this require?

Or am i just lazy and should get onto coding it properly?

H

PS excuse this somewhat random question...opinions would still be appreciated.

hagen00
March 8th, 2006, 09:39 PM
If i could figure out how to delete posted messages i would. Ignore that question. I was being very lazy and shouldn't have posted. Got it to work with sockets.

sphinx
March 9th, 2006, 01:34 AM
Ah, young padwan, you have resisted the pull of the dark side....

hagen00
March 9th, 2006, 08:54 AM
:D lol