Skip to main content

Jxta discovery

5 replies [Last post]
t0bis
Offline
Joined: 2007-01-25
Points: 0

I'm having problems with getting members of the netPeerGroup. I have 3 peers:

peer1 --(http)--> rendezvous (peer 3) <--(http)-- peer 2

If peer1 or peer2 sends discovery request like this:

discovery.getRemoteAdvertisements(null, DiscoveryService.PEER, null, null, 10);

and reads advertisements from local cache then:

Enumeration ads = discovery.getLocalAdvertisements(DiscoveryService.PEER, null, null);

enumeration contains only 2 ads: request initiator peer (peer1 or peer2 respectively) and rendezvous peer.

Can anyone explain me why I can not discover 3 peers?
Thanks in advance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
umberto85
Offline
Joined: 2007-06-15
Points: 0

Hi,
i have the same problem but i don't understand your resolution.
Can yuo help my?
Thanghs.

t0bis
Offline
Joined: 2007-01-25
Points: 0

I was connected to rendezvous peer before sending discovery requests.

I guess my mistake was that both peer1 and peer2 did not publish their adverts remotely in order to put their adverts into rendezvous peer's cache with non zero expiration.

I saw their adverts in rendezvous cache before with zero expiration. That leads to excluding these peers from discovery result set. I'm not sure why these adverts have zero expiration because I know little about discovery and rendezvous protocols.

When I published advert using remotePublish(...) call before sending discovery request, I was able to see all members of my group:

PeerAdvertisement padv = (PeerAdvertisement) AdvertisementFactory.newAdvertisement(PeerAdvertisement
.getAdvertisementType());

padv.setPeerID(config.getPeerID());
padv.setPeerGroupID(group.getPeerGroupID());
padv.setName(config.getName());
padv.setDescription(config.getDescription());

svcDiscovery.remotePublish(padv, PeerGroup.DEFAULT_EXPIRATION);

...

discovery.getRemoteAdvertisements(null, DiscoveryService.PEER, null, null, 10);

// waiting ...

Enumeration ads = discovery.getLocalAdvertisements(DiscoveryService.PEER, null, null);

If you see any reasons to improve my approach, please, don't hesitate to post your comments. :)

tra
Offline
Joined: 2003-06-16
Points: 0

> Can anyone explain me why I can not discover 3
> peers?

Are you waiting for the RendezVous event connect before
issuing your getRemote discovery request.

Hth,

B.

> Thanks in advance.

t0bis
Offline
Joined: 2007-01-25
Points: 0

Thanks for reply.

I'm not. I am waiting just 3 or 5 seconds after sending discovery request.
Do I need always wait for rendezvous event "connect" before examine local cache?

Could you also advise me a link where I can learn about discovery and become aware of simple mistakes?

tra
Offline
Joined: 2003-06-16
Points: 0

>
> Could you also advise me a link where I can learn
> about discovery and become aware of simple mistakes?

Check the discovery tutorial on jxta.org

http://www.jxta.org/Tutorials.html

Hth,

B.