Пример #1
0
        ///////////////////////////////////////////////////////////////////////////////////////


        protected override void SetCallback()
        {
            // 设置tcpagent的callback
            _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);
            _OnShutdown       = new Sdk.OnShutdown(SDK_OnShutdown);
            _OnHandShake      = new Sdk.OnHandShake(SDK_OnHandShake);

            // 设置 Socket 监听器回调函数
            HttpSdk.HP_Set_FN_HttpAgent_OnPrepareConnect(pListener, _OnPrepareConnect);
            HttpSdk.HP_Set_FN_HttpAgent_OnConnect(pListener, _OnConnect);
            HttpSdk.HP_Set_FN_HttpAgent_OnSend(pListener, _OnSend);
            HttpSdk.HP_Set_FN_HttpAgent_OnReceive(pListener, _OnReceive);
            HttpSdk.HP_Set_FN_HttpAgent_OnClose(pListener, _OnClose);
            HttpSdk.HP_Set_FN_HttpAgent_OnShutdown(pListener, _OnShutdown);
            HttpSdk.HP_Set_FN_HttpAgent_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);
            _OnStatusLine      = new HttpSdk.OnStatusLine(SDK_OnStatusLine);
            _OnHeadersComplete = new HttpSdk.OnHeadersComplete(SDK_OnHeadersComplete);
            _OnBody            = new HttpSdk.OnBody(SDK_OnBody);
            _OnMessageComplete = new HttpSdk.OnMessageComplete(SDK_OnMessageComplete);
            _OnParseError      = new HttpSdk.OnParseError(SDK_OnParseError);
            //增加事件!
            _OnWSMessageBody     = new HttpSdk.OnWSMessageBody(SDK_OnWSMessageBody);
            _OnWSMessageComplete = new HttpSdk.OnWSMessageComplete(SDK_OnWSMessageComplete);
            _OnWSMessageHeader   = new HttpSdk.OnWSMessageHeader(SDK_OnWSMessageHeader);


            HttpSdk.HP_Set_FN_HttpAgent_OnMessageBegin(pListener, _OnMessageBegin);
            HttpSdk.HP_Set_FN_HttpAgent_OnStatusLine(pListener, _OnStatusLine);
            HttpSdk.HP_Set_FN_HttpAgent_OnHeader(pListener, _OnHeader);
            HttpSdk.HP_Set_FN_HttpAgent_OnHeadersComplete(pListener, _OnHeadersComplete);
            HttpSdk.HP_Set_FN_HttpAgent_OnBody(pListener, _OnBody);
            HttpSdk.HP_Set_FN_HttpAgent_OnChunkHeader(pListener, _OnChunkHeader);
            HttpSdk.HP_Set_FN_HttpAgent_OnChunkComplete(pListener, _OnChunkComplete);
            HttpSdk.HP_Set_FN_HttpAgent_OnMessageComplete(pListener, _OnMessageComplete);
            HttpSdk.HP_Set_FN_HttpAgent_OnUpgrade(pListener, _OnUpgrade);
            HttpSdk.HP_Set_FN_HttpAgent_OnParseError(pListener, _OnParseError);
            //增加
            HttpSdk.HP_Set_FN_HttpAgent_OnWSMessageBody(pListener, _OnWSMessageBody);
            HttpSdk.HP_Set_FN_HttpAgent_OnWSMessageComplete(pListener, _OnWSMessageComplete);
            HttpSdk.HP_Set_FN_HttpAgent_OnWSMessageHeader(pListener, _OnWSMessageHeader);
        }
Пример #2
0
        /// <summary>
        /// 设置回调函数
        /// </summary>
        protected virtual void SetCallback()
        {
            // 设置 Socket 监听器回调函数
            _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);

            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);
        }
Пример #3
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);
        }
Пример #4
0
        /// <summary>
        /// 设置回调函数
        /// </summary>
        protected virtual void SetCallback()
        {
            _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);
            _OnShutdown       = new Sdk.OnShutdown(SDK_OnShutdown);

            // 设置 Socket 监听器回调函数
            Sdk.HP_Set_FN_Agent_OnPrepareConnect(pListener, _OnPrepareConnect);
            Sdk.HP_Set_FN_Agent_OnConnect(pListener, _OnConnect);
            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_Agent_OnShutdown(pListener, _OnShutdown);
        }
Пример #5
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);
        }
Пример #6
0
 public static extern void HP_Set_FN_HttpClient_OnSend(IntPtr pListener, Sdk.OnSend fn);