0

I have a problem with jxta. I dont get peer list.

        @Override public void discoveryEvent(DiscoveryEvent event) {
           DiscoveryResponseMsg res = event.getResponse();
           Enumeration en = res.getAdvertisements();
            if (en != null) {
            while (en.hasMoreElements()) {
            PeerAdvertisement a = (PeerAdvertisement)en.nextElement();
            Console.append(a.name()+"\n");
            }
           }

and

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

Console.append - is append to JTextArea. In this console print only one peer, but jxtanetwork have 3 peers. Where is error? P.S. I get code from How do I discover peers and send messages in JXTA-JXSE 2.6? P.P.S Sorry for my bad english.. I'm hope for your help... Thanks

Community
  • 1
  • 1
  • Oh, f*ck. I'm dummie. Problem is solved. discovery.getRemoteAdvertisements(null, DiscoveryService.PEER, null, null, **1**, null); - this is maximum of peer advertisement in each discovery response. If replace 1 on 5 (e.g.) - it's work. – user1392077 May 13 '12 at 11:37

1 Answers1

0

1 is the issue, it is the maximum number of answers your will get back (1 is less than 3).

Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453