Skip to main content

ask some questions about JXTA platform

4 replies [Last post]
sinsigma
Offline
Joined: 2009-04-15

hi everybody,i wanna ask some question about the p2p platform--jxta
in the old version,the jxtasocket constructor jxtasocket(PeerGroup, Messenger, PipeAdvertisement, StructuredDocument, boolean) still existed,can anyone tell me what's the meaning of every parameters in this constructor?
and now in the jxta 2.5,this constructor is murdered...which constructor i should use to do the same thing as the old one?thx a lot~

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
enygma2002
Offline
Joined: 2008-12-22

Here's apiece of code that might help you understand:

DiscoveryService discoveryService = this.currentJoinedGroup.getDiscoveryService();

PipeAdvertisement pipeAdv = (PipeAdvertisement)AdvertisementFactory.newAdvertisement(
PipeAdvertisement.getAdvertisementType());

PipeID id = (PipeID)IDFactory.newPipeID(currentJoinedGroup.getPeerGroupID());
pipeAdv.setPipeID(id);
pipeAdv.setName(getMyDirectCommunicationPipeName());
pipeAdv.setType(PipeService.UnicastType);

this.logger.debug("Publishing pipe advertisement.");
discoveryService.publish(pipeAdv);
discoveryService.remotePublish(pipeAdv);

this.serverSocket = new JxtaServerSocket(this.currentJoinedGroup, pipeAdv);

// Enable waiting for connections indefinitely for the accept() method.
this.serverSocket.setSoTimeout(0);

JxtaSocket aConnection = this.serverSocket.accept();

sinsigma
Offline
Joined: 2009-04-15

thx for your reply~but i still got no idea about the function of structuredDocument.And one more question:how could i set a proper rendezvous and relay seed?now i am using

config.addRdvSeedingURI(new URI("http://rdv.jxtahosts.net/cgi-bin/rendezvous.cgi?2"));
config.addRelaySeedingURI(new URI("http://rdv.jxtahosts.net/cgi-bin/relays.cgi?2"));

and the system can't connect...

enygma2002
Offline
Joined: 2008-12-22

Hi!

I just gave you the answer to your question with a working example.

Please read the jxta documentation and the javadocs for such questions, then ask on the forum.

The StructuredDocument, as far as I understand/care, is just a container for advertisement data that is visible to the user as an XML document. (AFAIK, it actually is a subclass of XMLElement)

About the seeds:
config.addSeedRelay("tcp://ip:port");
or
config.addSeedRelay("http://ip:port");

For Rendezvous:
config.addSeedRdv("tcp://ip:port");

All of this is available in the jxta javadocs (or in your IDE's auto-complete), just look for it.

Good luck!

P.S.: The public network is pretty much dead. Thx jxta people got the seedingUris to work again, but the seeds themselves not. I think they just dropped the whole public network ideea. Too bad, and with no notice.

sinsigma
Offline
Joined: 2009-04-15

thx again for ur guide~
well...actually i looked for that in the doc before,and there is no declaration about that parameter...may be i missed sth
if the public network is dead,how can i set up a rendezvous by myself?work with the class NetworkConfigurator&NetworkConfigurator?these days troubled u alot...