Skip to main content

Discovery question

3 replies [Last post]
dc5
Offline
Joined: 2008-08-31
Points: 0

Hey,

To handle discovery I am going to run it in a seperate thread, which say run's every 15-30 seconds - is this a good idea or is there better ways to handle it?

Cheers,

DC5

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jtanago
Offline
Joined: 2008-06-18
Points: 0

Hi!

The best way is to implement a DiscoveryListener and process each response on DiscoveryEvent. You have a great example on the programmer's guide.

dc5
Offline
Joined: 2008-08-31
Points: 0

> The best way is to implement a DiscoveryListener and process each response on DiscoveryEvent.

This is what I have already. Sorry my question might not have been clear, when my program is running I want to send a Discovery query every 15-30 seconds (In order to check for new peers joining the network at anytime).

I could do this in a while loop running in a seperate thread but I wanted to check if there was any other ways or better ways to do it?

DC5

jtanago
Offline
Joined: 2008-06-18
Points: 0

Hi!

I'm programming an application with similar characteristic. When a peer joins a group, he sends a HELLO message through the common pipe (a propagated one) with his name and his peerID. Furthermore I schedule a task that do a getRemoteAdvertisement every 10-15min.

Bye