Skip to main content

Executing the client server example in the JXTA v2.3.x java tm pg guide

2 replies [Last post]
Joined: 2005-08-28
Points: 0

I have been trying to get the server and client communicate for a long time....
I have been able to publish the pipeserver.adv and at the client side have been able to retreive the advertisement after searching for the module spec using

while (true) {
try {
// let's look first in our local cache to see
// if we have it! We try to discover an adverisement
// which as the (Name, JXTA-EX1) tag value
en = discovery.getLocalAdvertisements(DiscoveryService.ADV
, "Name"
// Ok we got something in our local cache does not
// need to go further!
if ((en != null) && en.hasMoreElements()) {
// We could not find anything in our local cache, so let's send a
// remote discovery request searching for the service
// advertisement.
, DiscoveryService.ADV
, "Name"
, "JXTASPEC:JXTA-EX1",1, null);
// The discovery is asynchronous as we do not know
// how long is going to take
try { // sleep as much as we want. Yes we
// should implement asynchronous listener pipe...
} catch (Exception e) {}
catch (IOException e) {
// found nothing! move on

I also have been able to execute the code

System.out.println("we found the service advertisement");
// Ok get the service advertisement as a Spec Advertisement
ModuleSpecAdvertisement mdsadv = (ModuleSpecAdvertisement) en.nextElement();
try {
// in the advertisement.
PipeAdvertisement pipeadv = mdsadv.getPipeAdvertisement();
printXmlAdvertisement(" Pipe ad retreived " , pipeadv);

but when i try to execute

for (int i=0; i<3; i++) {
myPipe = pipes.createOutputPipe(pipeadv, 30000);

i am thrown Output Pipe could not be resolved after 30000ms.
at net.jxta.impl.pipe.PipeServiceImpl.createOutputPipe(
at net.jxta.impl.pipe.PipeServiceImpl.createOutputPipe(
at net.jxta.impl.pipe.PipeServiceInterface.createOutputPipe(
at Client.startClient(
at Client.startJxta(
at Client.main(

Now both the server and the cleint are running on a single machine ....What am i doing wrong

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-08-28
Points: 0

the pipe adv is




And have done nothing but what the programming guide says i should do ...

Joined: 2007-10-12
Points: 0

Hey, I'm having the same exact problem..

I can find the advertisement of the pipe but cannot open the output pipe.. I dont know why...