示例#1
0
 public List <Post> GetPostsFromLastDate(DateTime dt, Friend friend)
 {
     for (int i = 1; i <= Config.Instance.NumberOfReplicas; i++)
     {
         ServerToServerServices obj = (ServerToServerServices)Activator.GetObject(typeof(ServerToServerServices), friend.Address + ":" + (friend.Port + i) + "/ServerToServerServices");
         if (obj != null)
         {
             try
             {
                 return(obj.GetPostsFromLastDate(dt));
             }
             catch (IOException) { }
             catch (SocketException) { }
         }
     }
     throw new ServiceUnavailableException("Could not notify user of acceptance.");
 }
示例#2
0
 public void RejectFriendRequest(FriendRequest fr)
 {
     for (int i = 1; i <= Config.Instance.NumberOfReplicas; i++)
     {
         ServerToServerServices obj = (ServerToServerServices)Activator.GetObject(typeof(ServerToServerServices), fr.FromAddress + ":" + (fr.FromPort + i) + "/ServerToServerServices");
         if (obj != null)
         {
             try
             {
                 obj.RejectFriendRequest(fr);
                 return;
             }
             catch (IOException) { }
             catch (SocketException) { }
         }
     }
     throw new ServiceUnavailableException("Could not notify user of rejection.");
 }
示例#3
0
 public void SendFriendRequest(FriendRequest fr)
 {
     for (int i = 1; i <= Config.Instance.NumberOfReplicas; i++)
     {
         ServerToServerServices obj = (ServerToServerServices)Activator.GetObject(typeof(ServerToServerServices), fr.SendTo + ":" + (fr.SendToPort + i) + "/ServerToServerServices");
         if (obj != null)
         {
             try
             {
                 obj.ReceiveFriendRequest(fr);
                 return;
             }
             catch (IOException) { }
             catch (SocketException) { }
         }
     }
     throw new ServiceUnavailableException("Could not deliver friend request, please try again later.");
 }
示例#4
0
        public void AcceptFriendRequest(FriendRequest fr)
        {
            Profile profile = (Profile)ServerManager.Instance.ServerInstance.ReadDomainObject("Profile");

            fr.RequestedUserName = profile.UserName;
            for (int i = 1; i <= Config.Instance.NumberOfReplicas; i++)
            {
                ServerToServerServices obj = (ServerToServerServices)Activator.GetObject(typeof(ServerToServerServices), fr.FromAddress + ":" + (fr.FromPort + i) + "/ServerToServerServices");
                if (obj != null)
                {
                    try
                    {
                        obj.AcceptFriendRequest(fr);
                        return;
                    }
                    catch (IOException) { }
                    catch (SocketException) { }
                }
            }
            throw new ServiceUnavailableException("Could not notify user of acceptance.");
        }