Initially It was not working because of that I had forget to implement one code line that perform the call to register() method of endpoint reference object.
Not only that. There are some other points also that I found and which was not mentioned in freepastry tutorial.
1) For the Bootstrap node bootAdress(InetAdrress) should be the real Ip( or the domain name also could be worked but I didn't check ) of the machine and the boot port and bind port should be equal.
e.g
int bindport = Integer.parseInt(args[0]);
InetAdress bootaddr = InetAddress.getByName(args[1]);
int bootport = Integer.parseInt(args[2]);
..............
............
node.boot(bootaddress);
Note that here if you start new node as the bootstrap(parent) node then you should pass local IP or domain name of local maching as as the bootaddr and same port number for both bindport and bootport.
So if the ip of the local machin is 192.168.1.100 then your command line arguments should be like
$java [-options] class
2) In FreePastry Application class (in this example MyApp) where we normally initiate the reference for Endpoint, dont forget to call register() method.
import rice.p2p.commonapi.Application;
import rice.p2p.commonapi.Endpoint;
import rice.p2p.commonapi.Id;
import rice.p2p.commonapi.Message;
import rice.p2p.commonapi.Node;
import rice.p2p.commonapi.NodeHandle;
import rice.p2p.commonapi.RouteMessage;
public class MyApp implements Application {
protected Endpoint endpoint;
public MyyApp(Node node) {
this.endpoint = node.buildEndpoint(this, "myinstance");
this.endpoint.register();
}
//some codes go here
................
..................
}
Therefore the Warning is...
If somebody wish to implement freepastry and forget to call this register() method your other pastry nodes who are waiting to receive messages from the first node wont receive pastry messages.
Can you post all your program in this example? Indeed, the tutoria(l (two and three)of freepastry doesn't work on distant machines.
ReplyDeleteI followed your tutorial, and i always have the same problems, the client cannot join the ring (bootstrat failed). I run the program that make the ring on a first machine (9002 ipdistante 9002), and on the second i run the second program that try to connect to the first machine(9001 ipdistante 9002). Thank you for your answers.