Jump to content

Recommended Posts

Posted

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

Posted

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)

Posted

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

 

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...