示例#1
0
        protected virtual void SetCallback()
        {
            _OnPrepareListen = new Sdk.OnPrepareListen(SDK_OnPrepareListen);
            _OnAccept        = new Sdk.OnAccept(SDK_OnAccept);
            _OnSend          = new Sdk.OnSend(SDK_OnSend);
            _OnReceive       = new Sdk.OnReceive(SDK_OnReceive);
            _OnClose         = new Sdk.OnClose(SDK_OnClose);
            _OnShutdown      = new Sdk.OnShutdown(SDK_OnShutdown);

            Sdk.HP_Set_FN_Server_OnPrepareListen(pListener, _OnPrepareListen);
            Sdk.HP_Set_FN_Server_OnAccept(pListener, _OnAccept);
            Sdk.HP_Set_FN_Server_OnSend(pListener, _OnSend);
            Sdk.HP_Set_FN_Server_OnReceive(pListener, _OnReceive);
            Sdk.HP_Set_FN_Server_OnClose(pListener, _OnClose);
            Sdk.HP_Set_FN_Server_OnShutdown(pListener, _OnShutdown);
        }
示例#2
0
        /// <summary>
        /// 设置回调函数
        /// </summary>
        protected virtual void SetCallback()
        {
            // 设置 Socket 监听器回调函数
            _OnAccept         = new Sdk.OnAccept(SDK_OnAccept);
            _OnPrepareConnect = new Sdk.OnPrepareConnect(SDK_OnPrepareConnect);
            _OnConnect        = new Sdk.OnConnect(SDK_OnConnect);
            _OnSend           = new Sdk.OnSend(SDK_OnSend);
            _OnReceive        = new Sdk.OnReceive(SDK_OnReceive);
            _OnClose          = new Sdk.OnClose(SDK_OnClose);
            _OnHandShake      = new Sdk.OnHandShake(SDK_OnHandShake);

            Sdk.HP_Set_FN_Client_OnPrepareConnect(pListener, _OnPrepareConnect);
            Sdk.HP_Set_FN_Client_OnConnect(pListener, _OnConnect);
            Sdk.HP_Set_FN_Client_OnSend(pListener, _OnSend);
            Sdk.HP_Set_FN_Client_OnReceive(pListener, _OnReceive);
            Sdk.HP_Set_FN_Client_OnClose(pListener, _OnClose);
            Sdk.HP_Set_FN_Client_OnHandShake(pListener, _OnHandShake);
        }
示例#3
0
        protected override void SetCallback()
        {
            // 设置tcpserver的callback
            _OnPrepareListen = new Sdk.OnPrepareListen(SDK_OnPrepareListen);
            _OnAccept        = new Sdk.OnAccept(SDK_OnAccept);
            _OnSend          = new Sdk.OnSend(SDK_OnSend);
            _OnReceive       = new Sdk.OnReceive(SDK_OnReceive);
            _OnClose         = new Sdk.OnClose(SDK_OnClose);
            _OnShutdown      = new Sdk.OnShutdown(SDK_OnShutdown);
            _OnHandShake     = new Sdk.OnHandShake(SDK_OnHandShake);

            HttpSdk.HP_Set_FN_HttpServer_OnPrepareListen(pListener, _OnPrepareListen);
            HttpSdk.HP_Set_FN_HttpServer_OnAccept(pListener, _OnAccept);
            HttpSdk.HP_Set_FN_HttpServer_OnSend(pListener, _OnSend);
            HttpSdk.HP_Set_FN_HttpServer_OnReceive(pListener, _OnReceive);
            HttpSdk.HP_Set_FN_HttpServer_OnClose(pListener, _OnClose);
            HttpSdk.HP_Set_FN_HttpServer_OnShutdown(pListener, _OnShutdown);
            HttpSdk.HP_Set_FN_HttpServer_OnHandShake(pListener, _OnHandShake);


            // 设置自身的callback
            _OnMessageBegin    = new HttpSdk.OnMessageBegin(SDK_OnMessageBegin);
            _OnHeader          = new HttpSdk.OnHeader(SDK_OnHeader);
            _OnChunkHeader     = new HttpSdk.OnChunkHeader(SDK_OnChunkHeader);
            _OnChunkComplete   = new HttpSdk.OnChunkComplete(SDK_OnChunkComplete);
            _OnUpgrade         = new HttpSdk.OnUpgrade(SDK_OnUpgrade);
            _OnRequestLine     = new HttpSdk.OnRequestLine(SDK_OnRequestLine);
            _OnHeadersComplete = new HttpSdk.OnHeadersComplete(SDK_OnHeadersComplete);
            _OnBody            = new HttpSdk.OnBody(SDK_OnBody);
            _OnMessageComplete = new HttpSdk.OnMessageComplete(SDK_OnMessageComplete);
            _OnParseError      = new HttpSdk.OnParseError(SDK_OnParseError);

            HttpSdk.HP_Set_FN_HttpServer_OnMessageBegin(pListener, _OnMessageBegin);
            HttpSdk.HP_Set_FN_HttpServer_OnRequestLine(pListener, _OnRequestLine);
            HttpSdk.HP_Set_FN_HttpServer_OnHeader(pListener, _OnHeader);
            HttpSdk.HP_Set_FN_HttpServer_OnHeadersComplete(pListener, _OnHeadersComplete);
            HttpSdk.HP_Set_FN_HttpServer_OnBody(pListener, _OnBody);
            HttpSdk.HP_Set_FN_HttpServer_OnChunkHeader(pListener, _OnChunkHeader);
            HttpSdk.HP_Set_FN_HttpServer_OnChunkComplete(pListener, _OnChunkComplete);
            HttpSdk.HP_Set_FN_HttpServer_OnMessageComplete(pListener, _OnMessageComplete);
            HttpSdk.HP_Set_FN_HttpServer_OnUpgrade(pListener, _OnUpgrade);
            HttpSdk.HP_Set_FN_HttpServer_OnParseError(pListener, _OnParseError);
        }
示例#4
0
 public static extern void HP_Set_FN_HttpServer_OnAccept(IntPtr pListener, Sdk.OnAccept fn);