I am developping a JXTA based application in Java with JXSE. It work very well locally, but now i try to get this work on internet.
For exemple, i have 2 computers on a local network. They will find each other immediatly, and the application will work. No problem.
Now, i have these 2 computers, and 2 others computers on an other local network. As i understand it, i need, for minimum requierement, 2 public RendezVous peer (one on each local network) that will be connected. But i can't find how to deal with it.
In my application, i use the setAutoStart method, that's mean the peer will be promoted to a RendezVous peer automatically if needed.
So i think, it's impossible for 2 distant peer to discover each other without give then their public adresse. So i need to retrieve a valid tcp adress on a peer and give it to the others. If someone know how to do that, i will be very happy !
Edit: my config
//Network setup
try {
manager = new NetworkManager(NetworkManager.ConfigMode.EDGE, peer_name, conf.toURI());
} catch (IOException e) {
//chemin incorrect ?
e.printStackTrace();
System.exit(-1);
}
try {
NetworkConfigurator configurator = manager.getConfigurator();
configurator.setTcpPort(port);
configurator.setTcpEnabled(true);
configurator.setTcpIncoming(true);
configurator.setTcpOutgoing(true);
configurator.setUseMulticast(true);
configurator.setPeerID(peer_id);
} catch (IOException e) {
// ? Si le dossier a bien été crée pas trop de raison d'avoir cette exception
e.printStackTrace();
}
// ..... some code ....... ///
PeerGroup net_group = manager.startNetwork();
net_group.getRendezVousService().setAutoStart(true);
So i would create a addRendezVous(URI uri) or addRendezVous(String uri) that work with net_group.getRendezVousService, but i don't really know how to find the URI or adress ..
And my app :
From my experience, I can suggest the following:
1) ensure that the port and IP address are open and available. If you have an antivirus, make sure that the port is opened.
2) The log messages are very informative. Can you post the log messages that you are getting ? Look for something like this in your log messages: New Seeding... Jul 31, 2013 6:50:05 PM net.jxta.impl.endpoint.netty.AsynchronousNettyMessenger connectionDied
3) Ensure that the network manager waits for a sufficient duration to connect to a Rendezvous, before connection times out. Something like this shuld make the edge wait long enough:
boolean connected = NetworkManager.waitForRendezvousConnection(20 * 1000);
Also, you can add the Rendezvous Server's seeding address to the edge peer's network configuration. Here is the code I used:
NetworkManager edgePeerManager = new NetworkManager(NetworkManager.ConfigMode.EDGE,...);
NetworkConfigurator edgePeerConfigurator = edgePeerManager.getConfigurator();
// This is the rendezvous' IP address and listening port
RendezvouServerTCPSeed = "tcp://192.XXX.X.XX:9705";
edgePeerConfigurator.addRdvSeedingURI(RendezvouServerTCPSeed);
PeerGroup edgePeerGroup= edgePeerManager.startNetwork();
In the Rendezvous Server, if the connection is successful, you will get a message at the console saying:
INFO: Line 145 net.jxta.impl.endpoint.netty.NettyTransportClient.getMessenger()
processing request to open connection to tcp://192.XXX.X.XX:9705
net.jxta.impl.endpoint.netty.NettyTransportClient getMessenger
INFO: succeeded in connecting to tcp://192.XXX.X.XX:9705, remote peer has logical address jxta://cbid-5961XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Do Let me know, if you have a solution to your problem.
Thanks DD