Пример #1
0
        public void OnClientConnectionRefused(NFTCPEventParams eventParams)
        {
            Debug.Log("Client refused");
            client.net.mxListener.Log("Client refused");

            client = null;
        }
Пример #2
0
        bool OnDataReceived(NFClientNet client, byte[] bytes, UInt32 bytesCount)
        {
            if (bytes.Length == bytesCount)
            {
                object structType = new MsgHead();
                StructureTransform.ByteArrayToStructureEndian(bytes, ref structType, 0);
                MsgHead head = (MsgHead)structType;

                Int32 nBodyLen = (Int32)bytesCount - (Int32)ConstDefine.NF_PACKET_HEAD_SIZE;
                if (nBodyLen > 0)
                {
                    byte[] body = new byte[nBodyLen];
                    Array.Copy(bytes, ConstDefine.NF_PACKET_HEAD_SIZE, body, 0, nBodyLen);

                    client.net.mxBinMsgEvent.OnMessageEvent(head, body);
                    return(true);
                }
                else
                {
                    //space packet
                }
            }

            return(false);
        }
        public void OnClientConnectionRefused(NFTCPEventParams eventParams)
        {
            Debug.Log("Client refused");
            client.net.mxListener.Log("Client refused");

            client = null;
        }
Пример #4
0
    public void StartConnect(string strIP, int nPort)
    {
        mxObjectElement = new NFObjectElement();

        mxClient = new NFClientNet(this);        
        mxBinMsgEvent = new NFBinraryMessageEvent(this);
        mxSendLogic = new NFBinarySendLogic(this);
        mxResultLogic = new NFCResultLogic(this);
        mxListener = new NFCoreExListener(this);
        mxListener.Init();

        mxClient.Connect(strIP, nPort);

    }
Пример #5
0
 public NFBinaryClientListener(NFClientNet c)
 {
     client = c;
 }
 public NFBinaryClientListener(NFClientNet c)
 {
     client = c;
 }
        bool OnDataReceived(NFClientNet client, byte[] bytes, UInt32 bytesCount)
        {
            if (bytes.Length == bytesCount)
            {
                object structType = new MsgHead();
                StructureTransform.ByteArrayToStructureEndian(bytes, ref structType, 0);
                MsgHead head = (MsgHead)structType;

                Int32 nBodyLen = (Int32)bytesCount - (Int32)ConstDefine.NF_PACKET_HEAD_SIZE;
                if (nBodyLen > 0)
                {
                    byte[] body = new byte[nBodyLen];
                    Array.Copy(bytes, ConstDefine.NF_PACKET_HEAD_SIZE, body, 0, nBodyLen);

                    client.net.mxBinMsgEvent.OnMessageEvent(head, body);
                    return true;
                }
                else
                {
                    //space packet
                }
            }

            return false;
        }