Ejemplo n.º 1
0
 public void CreateProfile(string name, string gender, int age, List <string> interests, string address, int port)
 {
     for (int i = 0; i < Config.Instance.NumberOfReplicas; i++)
     {
         string addr;
         lock (indexLock)
         {
             addr = replicas[(serverAddressToCall + i) % Config.Instance.NumberOfReplicas];
         }
         IClientServices obj = (IClientServices)Activator.GetObject(typeof(IClientServices), addr + "/ClientServices");
         if (obj != null)
         {
             try
             {
                 obj.CreateProfile(name, gender, age, interests, address, port);
                 return;
             }
             catch (IOException) { }
             catch (SocketException) { }
         }
     }
     throw new ServiceUnavailableException("Unable to contact any server.");
 }