Пример #1
0
        protected override void Init(byte[] param)
        {
            base.Init();

            Gateway_Init gatewayInit = new Gateway_Init(param);

            SetTCPObjectId((int)gatewayInit.tcp_server_id);

            RegisterSocketMethods("SocketAccept", SocketAccept);
            RegisterSocketMethods("SocketData", SocketData);
            RegisterSocketMethods("SocketError", SocketError);
        }
Пример #2
0
        private void InitGateway()
        {
            string gatewayClass = m_bootConfig["Gateway"]["Class"].ToString();
            string gatewayName  = m_bootConfig["Gateway"]["Name"].ToString();

            m_tcpGate = new TCPServer();
            m_tcpObjectContainer.Add(m_tcpGate);

            Gateway_Init gateInit = new Gateway_Init();

            gateInit.tcp_server_id = m_tcpGate.GetObjectId();

            int gatewayId = SparkServerUtility.NewService(gatewayClass, gatewayName, gateInit.encode());

            m_tcpGate.Start(m_gateIp, m_gatePort, 30, gatewayId, OnSessionError, OnReadPacketComplete, OnAcceptComplete);
        }