Ejemplo n.º 1
0
        ///// <summary>
        ///// UDP异步开始发送
        ///// </summary>
        ///// <param name="packData">数据信息</param>
        ///// <param name="length">数据长度</param>
        //public void AddSendMsg(byte[] packData, int length)
        //{
        //    try
        //    {
        //        udpSend.BeginSend(packData, length, readCallback, udpSendState);
        //    }
        //    catch
        //    {
        //    }
        //}
        #endregion
        #region UDP异步开始发送
        /// <summary>
        /// UDP异步开始发送
        /// </summary>
        /// <param name="vMsg">数据信息</param>
        public IMsg SendStart(IMsg vMsg)
        {
            try
            {
                if (vMsg.Length <= 0)
                {
                    return(vMsg.SetResVal(MsgEnu.SendNull));
                }

                udpSend.BeginSend(vMsg.Buffer, vMsg.Length, readCallback, udpSendState);
                return(vMsg);
            }
            catch
            {
            }
            return(new MsgError(MsgEnu.ErrSendFail));
        }