Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Yaroslav Chinskiy
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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{
conf = ClientProperties.getInstance();
}catch(IOException ioe){
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;
"RMI Port number error. 0 < port < 65535 The port was reset to 1099");
UnicastRemoteObject.exportObject(this, port);
private void connect() throws RemoteException{
rmiregistry = LocateRegistry.createRegistry(rmiPort);
}catch(RemoteException re){
rmiregistry = LocateRegistry.getRegistry(rmiPort);


rmiregistry.rebind(NAME, this);

}catch(Exception ce){
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!