Skip to main content

How to add message in peer advertisment

3 replies [Last post]
shaikh_sharique
Offline
Joined: 2010-06-17
Points: 0

hi,
I want to add message in tag of a peer advertisment, this message contain some information about peer in key value pair and pipe advertisment of a peer, so that only one advertisment will give all information about peer and pipe information so that peer can be contacted.

something like

UK
London
.
.
.other tags...
.
.

.......pipeadvertisment of peer

any peer receive this advertisment, will fetch this information and display to user and if user select then application will send message directly through embeded advertisment, rather then sending other pipe discovery message.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
adamman71
Offline
Joined: 2007-01-31
Points: 0

Sorry for the late reply. I am working on another project. In the future, I'll try to connect at least once per week to answer questions on the forum.

It is not recommended to modify core advertisements, because:

a) The system has not been designed and tested to support this.
b) If the JXTA/JXSE community modifies these advertisements in the future, there is a high probability that your code would be broken in a future release.

The info you want to provide should typically be inserted in one of the module advertisement (the module implementation advertisment on top of my head).

Remember that peer don't contact peers, but rather: peer services contact peer services (and a service is a type of module).

To add a service to a module implementation adverstisment, you can take a look at the code of StdPeerGroup.getDefaultModuleImplAdvertisement() foe example.

shaikh_sharique
Offline
Joined: 2010-06-17
Points: 0

Thanks for reply,
Reason I want to add extra information is because, if peer get any other peers advertisement, then he can get extra information about peer, for now I am searching for pipe advertisement, and one’s pipe advertisement is gain, then requesting peer connect with serving peer , and send another text message, let say getInfo, and then serving peer respond with XML document describing information, so this processes is fine but, this make unnecessary requests and generate traffic, plus connecting non interesting peers to get information can take time, so this can halt peer or seems to be not working to client.
is there any simple way to achive this functionality, or is there anything I can do with pipe advertisment ?

thanks

adamman71
Offline
Joined: 2007-01-31
Points: 0

You may attempt using queries instead of the discovery process. This is lighter. You can target a query to a specific peer by using the peer ID from its advertisement. The query answer could contain the info you want to transmit.