ealary Geschrieben May 29, 2013 at 16:06 Geschrieben May 29, 2013 at 16:06 Hi ! I want to use IPConnection to Enumerate each device connected to a Host (localhost for example) without user waiting (System.out.readline). How i can did that ? There isn't function to check that :/ Regards. ealary Zitieren
JavaLaurence Geschrieben May 29, 2013 at 18:12 Geschrieben May 29, 2013 at 18:12 Enumerating a stack configuration does not require user interaction. What is your issue with System.out.readXXX ? Zitieren
ealary Geschrieben May 29, 2013 at 21:10 Autor Geschrieben May 29, 2013 at 21:10 My issue is that i want wait to enumerate all device in an Host (Can have many host) before doing any processing. The issue with System.out.read is to past this statement, an user should interact. Without System.out.read, ipcon are disconnected and we aren't certain had enumerated devices... (Sorry for my English) Zitieren
JavaLaurence Geschrieben June 1, 2013 at 07:57 Geschrieben June 1, 2013 at 07:57 After re-reading what you wrote a few times (yes, I'm afraid your English is poor), I think I understand what you mean. I'm afraid the core issue is how to coordinate multiple threads. The enumeration callbacks are called on a different thread than your own application thread. The callbacks are performed by a thread that is started by the Tinkerforge framework. There are two approaches to solve the problem: a) the hack: include a hard-coded delay of a few seconds b) the proper way: use proper thread synchronization (e.g. using wait/notify, or any of the higher level concurrency mechanisms in java.util.concurrency). The hack will probably be OK, and is just a matter of calling Thread.delay(). HTH Zitieren
JavaLaurence Geschrieben June 1, 2013 at 17:42 Geschrieben June 1, 2013 at 17:42 (correction) .. make that last API call Thread.sleep(). Zitieren
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.