dcsimg

Can I contact multiple RMI Servers from a single RMI Client simultaneously ?

Shaun Childers

Sure, well not exactly simultaneously, but within the same client:


//imports here
public class MyClient {
  public static void main(String[] args){
    try {
      ThisServer server1 = (ThisServer)Naming.lookup("rmi://this.server.host/ThisServer");
      ThatServer server2 = (ThatServer)Naming.lookup("rmi://that.server.host/ThatServer");
   //now call some methods with each server
    catch(Exception e) {}
  }
}