port for underlying system?
Hi, i am currently writing my dissertation and have a client server architecture, i have written the rmi side of the project, however when i use the register and bind a service i have to specify the port which the server is hosting on as you would expect, but somewhere along the line java uses another port which must be open in order for it to work, my firewall initially blocked this warning me, but once i accepted it the program worked, until then it hung....
the code i use is :
//Server -
try{
reg = java.rmi.registry.LocateRegistry.createRegistry(port);
Naming.rebind("rmi://" + IPAddress +":" + port +"/TestServer",this);
}catch (AccessControlException a){
System.out.println("actions : " + a.getPermission().getActions());
System.out.println("name : " + a.getPermission().getName());
System.out.println("string : " + a.getPermission().toString());
}catch (MalformedURLException m){
System.out.println("Malformed : " + m.getMessage());
}
//Server -
//Client --
try{
Server_Interface serverside = (Server_Interface)Naming.lookup("rmi://" + ip +":" + port +"/TestServer");
//Do stuff from the server etc...
}catch(NotBoundException n){
System.out.println("NotBoundException : " + n.getMessage());
}catch(MalformedURLException m){
System.out.println("MalformedURLException : " + m.getMessage());
}catch(RemoteException e){
System.out.println("RemoteException : " + e.getMessage());
}
returnfalse;
//Client --
This all works fine, and specifying any port other than the one chosen for the server will not work, but i still need to know why or at least which port java is going to want as well? will it change etc?
Thanks for the help
Chris

