Skip to main content

How do I get started creating a custom peer search / discovery service?

1 reply [Last post]
Joined: 2010-06-18

I'm completely new to JXTA and just want some pointers to help get started.

I need to create a peer search / capability matching component, so I can search for and locate peers based on a number of custom criteria. In other words, peer A says 'I can do X, Y and K' and when peer B searches for peers that can do 'X and K', is able to discover peer A. Hope that makes sense.

Ideally, I'd like to be able to group peers by some high level criteria, perform searches for the group, and then search within the group for specific capabilities.

I don't need hand holding, just some suggestions as to how to go about this.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2009-12-28

Hi Manwood,

The things you're trying to do sound like broadcasting and searching for advertisements.

I see the problem as being split into 2 more simpler ones:
1. You need to be able to do a dynamic peer discovery over a LAN(with the same subnet mask)
2. You need to send and receive advertisements from the peers and in those you'll have X, Y and K things than one peer provides.

It's important to know which peer is online or not because advertisements don't tell you much about that...they only do what real-life advertisements do which is letting you know about a service. In the case peer A is listed as online than you should take that peer into account when applying the search for X and Y services.

Then it comes the part with advs. Those can be sent/received through the API and the scheme is pretty straightforward.

You should take a look at this: . I posted a file named which should be a starting point for taking a grip on advertisement manipulation.

Furthermore, take a look at this . Jerome(adamman) gave me a handy tip on how to do a proper peer discovery mechanism.

The main idea behind those 2 URLs is that you *should* use multicast sockets to handle peer discovery and advertisements look-up to handle services discovery.

As for the peer group part, I'll have to say I haven't dived into that yet, but you'll find some tips in Programmer's Guide for Jxta 2.6 and on this forum.

Few months ago when I found JXTA I was in the same situation so don't worry...things will get clear.

Good luck!