Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1. // ---------------- POŁĄCZENIE Z SERWEREM --------------------------------
  2.     public void ConnectToServer(String ip_adress, String port) {       
  3.         server = null;
  4.        
  5.         boolean error = false;
  6.        
  7.         try {
  8.             remote = Naming.lookup("rmi://" + ip_adress + ":" + port + "/" + "ArchiverServer");
  9.         } catch (MalformedURLException e) {
  10.             firePropertyChange("Connection error", 0, 1);
  11.             error = true;
  12.             e.printStackTrace();
  13.         } catch (RemoteException e) {
  14.             firePropertyChange("Connection error", 0, 1);
  15.             error = true;
  16.             e.printStackTrace();
  17.         } catch (NotBoundException e) {
  18.             firePropertyChange("Connection error", 0, 1);
  19.             error = true;
  20.             e.printStackTrace();
  21.         }
  22.  
  23.         if (remote instanceof RemoteInterface)
  24.              server = (RemoteInterface) remote;    
  25.        
  26.         if(error == false)
  27.             firePropertyChange("Connection good", 0, 1);
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement