Example #1
0
 /// <summary>
 /// Send broadcast answers to all users
 /// </summary>
 /// <param name="resp"></param>
 public void SendBroadcast(TcpMessage resp)
 {
     foreach (var User in Users)
     {
         SendRequest(User.Value.EndPoint, resp.GetBytes());
     }
 }
Example #2
0
        /// <summary>
        /// User request to end current talk
        /// </summary>
        public void HTalkEnd(TcpMessage Request)
        {
            if (OnTalkOccur != null)
            {
                OnTalkOccur(false, Request.From, Request.To);
            }
            IPEndPoint sender   = Users[Request.From].EndPoint;
            IPEndPoint receiver = Users[Request.To].EndPoint;

            SendRequest(receiver, Request.GetBytes());
            SendRequest(sender, new ResponseServerInfo("Talk end OK").GetBytes());
        }
Example #3
0
        /* Different connect handlers */
        #region Connect Handlers

        /* Handlers for decrypt call requests and transactions */
        #region Call handlers

        /// <summary>
        /// Transact talk answer message and begins the udp connection if required
        /// </summary>
        private void HTalkAnswer(TcpMessage Request)
        {
            if ((TalkState)Request.State == TalkState.Adopt)
            {
                if (OnTalkOccur != null)
                {
                    OnTalkOccur(true, Request.From, Request.To);
                }
            }
            IPEndPoint receiver = Users[Request.To].EndPoint;

            SendRequest(receiver, Request.GetBytes());
            IPEndPoint sender = Users[Request.From].EndPoint;

            SendRequest(sender,
                        new ResponseServerInfo("Talk answer with " + Request.To + " OK").GetBytes());
        }
Example #4
0
        /// <summary>
        /// Offer to talk
        /// </summary>
        public void HTalkOffer(TcpMessage Request)
        {
            if (!Users.ContainsKey(Request.To))
            {
                // This user is unavailable, and sender should remove this name from his userlist
                SendRequest(Users[Request.From].EndPoint,
                            new ResponseUser(Request.To, UserState.UserLogOut).GetBytes());
            }

            IPEndPoint receiver = Users[Request.To].EndPoint;

            SendRequest(receiver, Request.GetBytes());

            IPEndPoint sender = Users[Request.From].EndPoint;

            SendRequest(sender,
                        new ResponseServerInfo("Talk offer with " + Request.To + " is processing").GetBytes());
        }