Skip to main content

Locate Rendezvous Dinamically

3 replies [Last post]
pablinkus
Offline
Joined: 2007-06-28
Points: 0

Hi,
perhaps it is a very simple question but I'm trying to do that and I can get any result. I'm using the sample for the private network "http://www.petrovic.org/blog/2006/11/15/a-turnkey-private-jxta-net-demo", and I wanted to change it to reach the rendezvous dinamically. I have read this:
"The discovery service can be used to locate rendezvous peers dynamically during the execution of a peer. The discovery request code is
myDiscoveryService.getRemoteAdvertisements( null,
DiscoveryService.ADV,
netPeerGroup.getPeerGroupID().toString(),
100, myListener );
This code publishes a query into the current peer group, and looks for all advertisements with an element named RdvGroupID and a value of the current peergroup. The myListener() method is called when any rendezvous advertisements are found. The advertisements can be used to connect to the rendezvous peer"

The issue is that I don't receive any event in the peer. Has the rendezvous to do something special to answer this advertisements?

Thanks in advanced
Pablo

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
asghar
Offline
Joined: 2005-07-26
Points: 0

Hello Pablo,

I don´t know this sample. But after a look into the JXSE 2.4.1 API documentation, I saw that you don´t call the method getRemoteAdvertisements(…) correctly.
Replace it as listed below and please inform us, if the problem is solved:

myDiscoveryService.getRemoteAdvertisements( null,
DiscoveryService.ADV,
[b]RdvGroupID[/b]
netPeerGroup.getPeerGroupID().toString(),
100, myListener );

Asghar

asghar
Offline
Joined: 2005-07-26
Points: 0

Sorry, once again a small but important (syntax) error. Please use the following listing:

myDiscoveryService.getRemoteAdvertisements(
null,
DiscoveryService.ADV,
[b]RdvGroupID,[/b]
netPeerGroup.getPeerGroupID().toString(),
100,
myListener);

pablinkus
Offline
Joined: 2007-06-28
Points: 0

Hi Asghar,
thanks for replying. I'm a bit confused about how JXTA works or I don't understand it.
My idea was that a peer can look for rendezvous dynamically, but I can not get it. If I use the method you suggest in the peer (MyPeer.java), previously I have to change the property "setUseMulticast" to true and then using
discovery.getRemoteAdvertisements(
null,
DiscoveryService.ADV,
RdvAdvertisement.GroupIDTag,
appPeerGroup.getPeerGroupID().toString(),
100,
this);
the peer doesn't receive any event in the" discoveryEvent" method.

Then, if I change the rendezvous property "setUseMulticast" to true, the peer receives the rendezvous advertisements from the Rendezvous (if the "setUseMulticast" property remains true in the peer). But in this case the peer doesn't have to do anything to connect to the Rendezvous, neither send Discovery advertisements, because it connects automatically to the rendezvous.

I don't know if I can explain my doubts correctly. My idea was
- A rendezvous can announce itself by Rendezvous advertisements (via multicast), and a peer can use this advertisements to connect this rendezvous. In my case, it connects automatically, I don't have to do anything.
- A peer can use multicast to discover rendezvous. In my case, the rendezvous has to enable the multicast property, and in this case the peer connects automatically.

Thanks again for your ideas
Pablo