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

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

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

            IsCreate = true;

            return(true);
        }