Skip to main content

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

2 replies [Last post]
vishal_santoshi
Offline
Joined: 2005-08-28

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"
, "JXTASPEC:JXTA-EX1");
// Ok we got something in our local cache does not
// need to go further!
if ((en != null) && en.hasMoreElements()) {
break;
}
// We could not find anything in our local cache, so let's send a
// remote discovery request searching for the service
// advertisement.
discovery.getRemoteAdvertisements(null
, 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...
Thread.sleep(2000);
} catch (Exception e) {}
}
catch (IOException e) {
// found nothing! move on
}
System.out.print(".");
}

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

java.io.IOException: Output Pipe could not be resolved after 30000ms.
at net.jxta.impl.pipe.PipeServiceImpl.createOutputPipe(PipeServiceImpl.java:483)
at net.jxta.impl.pipe.PipeServiceImpl.createOutputPipe(PipeServiceImpl.java:408)
at net.jxta.impl.pipe.PipeServiceInterface.createOutputPipe(PipeServiceInterface.java:168)
at Client.startClient(Client.java:249)
at Client.startJxta(Client.java:147)
at Client.main(Client.java:122)

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.
vishal_santoshi
Offline
Joined: 2005-08-28

the pipe adv is



urn:jxta:uuid-9CCCDF5AD8154D3D87A391210404E59BE4B888209A2241A4A162A10916074A9504


JxtaUnicast


JXTA-EX1

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

mattia515
Offline
Joined: 2007-10-12

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...

Help