示例#1
0
        /// <summary>
        /// 处理消息
        /// </summary>
        /// <param name="ksModel"></param>
        /// <param name="uModel"></param>
        /// <returns></returns>
        internal int HandleMessage(KevSocketModel ksModel, UDPModel uModel)
        {
            int result_code = 200;

            do
            {
                if (ksModel == null)
                {
                    result_code = 401;
                    break;
                }

                IUDPServerDelegate del = GetDelegate(ksModel.MessageType);
                if (del == null)
                {
                    result_code = 402;
                    break;
                }

                result_code = del.HandleRequestMessage(uModel);
            } while (false);

            return(result_code);
        }
示例#2
0
 /// <summary>
 /// 设置代理
 /// </summary>
 /// <param name="del"></param>
 public void SetDelegate(IUDPServerDelegate del)
 {
     delegates.TryAdd(del.GetType(), del);
 }