Exemple #1
0
        /// <summary>
        /// 创建socket监听&服务组件
        /// </summary>
        /// <param name="isUseDefaultCallback">是否使用tcppullserver类默认回调函数</param>
        /// <returns></returns>
        protected override bool CreateListener()
        {
            if (IsCreate == true || pListener != IntPtr.Zero || pServer != IntPtr.Zero)
            {
                return(false);
            }

            pListener = HPSocketSdk.Create_HP_TcpPullServerListener();
            if (pListener == IntPtr.Zero)
            {
                return(false);
            }

            pServer = HPSocketSdk.Create_HP_TcpPullServer(pListener);
            if (pServer == IntPtr.Zero)
            {
                return(false);
            }

            IsCreate = true;

            return(true);
        }