Ejemplo n.º 1
0
 public void OnClientConnectionRefused(NFNetEventParams eventParams)
 {
     if (mHandlerDelegation != null)
     {
         mHandlerDelegation(NFNetEventType.ConnectionRefused);
     }
 }
Ejemplo n.º 2
0
        public void OnDataReceived(NFNetEventParams eventParams)
        {
            mPacket.Push(eventParams.packet.Sb, eventParams.packet.Sb.Size());
            eventParams.packet.Sb.Clear();

            OnDataReceived();
        }
Ejemplo n.º 3
0
 public void OnClientDisconnect(NFNetEventParams eventParams)
 {
     if (mHandlerDelegation != null)
     {
         mHandlerDelegation(NFNetEventType.Disconnected);
     }
 }
Ejemplo n.º 4
0
        //////////////////////////////////////////////////////////////////
        ///
        public void OnClientConnect(NFNetEventParams eventParams)
        {
            Array.Clear(mPacket, 0, ConstDefine.MAX_PACKET_LEN);

            //NFLogModule.Instance.Log(NFLogModule.LOG_LEVEL.DEBUG, "Client connected");

            mHandlerDelegation(NFNetEventType.Connected);
        }
Ejemplo n.º 5
0
        //////////////////////////////////////////////////////////////////
        ///
        public void OnClientConnect(NFNetEventParams eventParams)
        {
            mPacket.Clear();

            //NFLogModule.Instance.Log(NFLogModule.LOG_LEVEL.DEBUG, "Client connected");
            if (mHandlerDelegation != null)
            {
                mHandlerDelegation(NFNetEventType.Connected);
            }
        }
Ejemplo n.º 6
0
        public void OnDataReceived(NFNetEventParams eventParams)
        {
            byte[] bytes      = eventParams.packet.bytes;
            int    bytesCount = eventParams.packet.bytesCount;

            //NFLogModule.Instance.Log(NFLogModule.LOG_LEVEL.INFO, "ReciveDataSize:" + bytesCount);

            if (mnPacketSize + bytesCount < ConstDefine.MAX_PACKET_LEN)
            {
                Array.Copy(bytes, 0, mPacket, mnPacketSize, bytesCount);
                mnPacketSize += (UInt32)bytesCount;

                OnDataReceived();
            }
        }
Ejemplo n.º 7
0
        public void Execute()
        {
            while (mxEvents.Count > 0)
            {
                lock (mxEvents)
                {
                    NFNetEventType eventType = mxEvents.Dequeue();

                    NFNetEventParams eventParams = new NFNetEventParams();
                    eventParams.eventType = eventType;
                    eventParams.client    = this;
                    eventParams.socket    = mxClient;

                    if (eventType == NFNetEventType.Connected)
                    {
                        mxNetListener.OnClientConnect(eventParams);
                    }
                    else if (eventType == NFNetEventType.Disconnected)
                    {
                        mxNetListener.OnClientDisconnect(eventParams);

                        mxReader.Close();
                        mxWriter.Close();
                        mxClient.Close();
                    }
                    else if (eventType == NFNetEventType.DataReceived)
                    {
                        lock (mxPackets)
                        {
                            eventParams.packet = mxPackets.Dequeue();

                            mxNetListener.OnDataReceived(eventParams);
                        }
                    }
                    else if (eventType == NFNetEventType.ConnectionRefused)
                    {
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public void OnClientConnectionRefused(NFNetEventParams eventParams)
        {
            //NFLogModule.Instance.Log(NFLogModule.LOG_LEVEL.DEBUG, "Client refused");

            mHandlerDelegation(NFNetEventType.ConnectionRefused);
        }
Ejemplo n.º 9
0
        public void OnClientDisconnect(NFNetEventParams eventParams)
        {
            //NFLogModule.Instance.Log(NFLogModule.LOG_LEVEL.DEBUG, "Client disconnected");

            mHandlerDelegation(NFNetEventType.Disconnected);
        }