10.07.2015 Views

pdf - 395 K - Ecole des mines de Nantes

pdf - 395 K - Ecole des mines de Nantes

pdf - 395 K - Ecole des mines de Nantes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}return Instance;/// /// Makes a (possibly remote) Directory Facilitator availableon this computer./// This method is required because C# does not support staticinitialization/// blocks./// There is no need to call this method explicitly if theplatform on the/// main host is started first./// public static void Install(){if (Instance != null) return; // Already installedif (Middleware.ProcessIsMainHost())InstallServer();elseInstallClient();}host./// /// Current process is not main host: get proxy to DF on main/// private static void InstallClient(){string uri = "http://" + Middleware.GetMainHostName() +":"+ Middleware.SERVER_PORT + "/" + FUNCTION;// e.g.: http://samson.csse.monash.edu.au:1989/DFtry{Instance = (DirectoryFacilitator)Activator.GetObject(typeof (DirectoryFacilitator),uri);Console.WriteLine("DF - Available remotely");}catch(System.Net.WebException e){// Cannot get proxystring msg = "Cannot find Directory Facilitator onmain host: "+ uri + "\\n" + e.Message;throw new Exception(msg);}}/// /// Current process is main host: create DF and make itaccessible remotely./// private static void InstallServer(){Instance = new DirectoryFacilitator();RemotingServices.Marshal(Instance, FUNCTION);Console.WriteLine("DF - Available locally");}MSc EMOOSE Thesis – http://www.emn.fr/EMOOSE 76

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!