TroubleChick Posted September 26, 2013 Posted September 26, 2013 url = new URL(Config.WEB_LINK); is = url.openStream(); // throws an IOException br = new BufferedReader(new InputStreamReader(is)); int count = 0; while ((line = br.readLine()) != null) { if (count == 0) { comanda = line; } count++; } System.out.println("DEBUG: Webcheck:" + comanda); The file is a simple .txt file containing "Still doesen't work how it should." First output: DEBUG: Webcheck:announce Still doesen't work how it s Second output: DEBUG: Webcheck:announce Still doesen't work how it should. I've made a thread to check every 60 seconds and the first time doesen't read the whole line, but the second time it read it. Any idea why?
0 TroubleChick Posted September 26, 2013 Author Posted September 26, 2013 You don't get what am I asking. I wonder WHEN the php script acts and by who. The php script must be acting when java is trying to check, otherwise it has no sense. Exactly..no sense at all. Acts by me but not in the same with getting content from server
0 TroubleChick Posted September 27, 2013 Author Posted September 27, 2013 I think it's a problem of Linux because even using CURL or WGET to get the file, the first time i do isn't working and don't download completly. So i've made a "custom" that works very good. Thanks wyat for helping me. This is the code i used: class checkIt implements Runnable { @Override public void run() { Webcheck.checkContent(Webcheck.getContent(), false); Webcheck.checkContent(Webcheck.getContent(), true); System.out.println("DEBUG: Webcontroller: checking if any command"); } } public static void checkContent(String content, boolean isThis) { if (isThis) { //CODE } }
Question
TroubleChick
The file is a simple .txt file containing "Still doesen't work how it should."
First output: DEBUG: Webcheck:announce Still doesen't work how it s
Second output: DEBUG: Webcheck:announce Still doesen't work how it should.
I've made a thread to check every 60 seconds and the first time doesen't read the whole line, but the second time it read it.
Any idea why?
18 answers to this question
Recommended Posts