Jump to content

IPConnection Enumerate


ealary

Recommended Posts

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)

Link zu diesem Kommentar
Share on other sites

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

 

Link zu diesem Kommentar
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...