• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to make RMI to com using fixed sockets???

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I wrote an client/server app that uses RMI to exec/stop threads.
The client part creates rmiregistry on the port that I pick up from config file, same for my RMI object:

public AgentsManager() throws RemoteException{
try{
conf = ClientProperties.getInstance();
AgentFactory.init();
}catch(IOException ioe){
ExceptionHandler.handle(ioe,this.getClass());
System.exit(1);
}
port = Integer.parseInt(
conf.getProperty("port", "-1"));
if(port <= 1024 | | port >=65535){
port = 6566;
cat.warn("Port number error. 0 < port < 65535 The port was reset to 1100");
}
rmiPort = Integer.parseInt(
conf.getProperty("rmiPort", "-1"));
if(rmiPort <= 1024 | | rmiPort >=65535){
rmiPort = 6565;
cat.warn(
"RMI Port number error. 0 < port < 65535 The port was reset to 1099");
}
UnicastRemoteObject.exportObject(this, port);
}
private void connect() throws RemoteException{
try{
rmiregistry = LocateRegistry.createRegistry(rmiPort);
}catch(RemoteException re){
rmiregistry = LocateRegistry.getRegistry(rmiPort);
}

try{

rmiregistry.rebind(NAME, this);

}catch(Exception ce){
ce.printStackTrace();
}
}
Everything worked fine until firewall was installed. Firewall configured to allow 2 way comm on my ports. However, in order to do a lookup server picks a random port. Therefore, firewall blocks reply to that port and server times out. Is there any way to force server to use fixed port for lookup and communication??
Thank tou, Yarik.
 
reply
    Bookmark Topic Watch Topic
  • New Topic