send() public méthode

public send ( KBEngine.MemoryStream stream ) : bool
stream KBEngine.MemoryStream
Résultat bool
Exemple #1
0
        public IEnumerator sendCoroutine(NetworkInterface networkInterface, uint fId, PacketHolder par)
        {
            fini(true);
            Debug.Log("message Number " + streamList.Count);
            bool resp = false;

            if (networkInterface.valid())
            {
                for (int i = 0; i < streamList.Count; i++)
                {
                    stream = streamList[i];
                    networkInterface.send(stream.getbuffer(), delegate(Packet p) {
                        par.packet = p;
                        resp       = true;
                    }, fId);
                    Log.Sys("SendNetworkSuc");
                }
            }
            else
            {
                Dbg.ERROR_MSG("Bundle::send: networkInterface invalid!");
            }

            streamList.Clear();
            stream = new MemoryStream();

            while (!resp)
            {
                yield return(null);
            }
        }
Exemple #2
0
        public void send(NetworkInterface networkInterface)
        {
            fini(true);

            if (networkInterface.valid())
            {
                for (int i = 0; i < streamList.Count; i++)
                {
                    stream = streamList[i];
                    networkInterface.send(stream.getbuffer());
                }
            }
            else
            {
                Dbg.ERROR_MSG("Bundle::send: networkInterface invalid!");
            }

            // 把不用的MemoryStream放回缓冲池,以减少垃圾回收的消耗
            for (int i = 0; i < streamList.Count; ++i)
            {
                streamList[i].reclaimObject();
            }
            streamList.Clear();
            stream.clear();

            // 我们认为,发送完成,就视为这个bundle不再使用了,
            // 所以我们会把它放回对象池,以减少垃圾回收带来的消耗,
            // 如果需要继续使用,应该重新Bundle.createObject(),
            // 如果外面不重新createObject()而直接使用,就可能会出现莫名的问题,
            // 仅以此备注,警示使用者。
            Bundle.reclaimObject(this);
        }
Exemple #3
0
        public void send(NetworkInterface networkInterface)
        {
            fini(true);

            for (int i = 0; i < streamList.Count; i++)
            {
                stream = streamList[i];
                networkInterface.send(stream.getbuffer());
            }

            streamList.Clear();
            stream = new MemoryStream();
        }
Exemple #4
0
        public void send(NetworkInterface networkInterface)
        {
            fini(true);

            for(int i=0; i<streamList.Count; i++)
            {
                stream = streamList[i];
                networkInterface.send(stream.getbuffer());
            }

            streamList.Clear();
            stream = new MemoryStream();
        }
Exemple #5
0
 static int send(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         KBEngine.NetworkInterface obj  = (KBEngine.NetworkInterface)ToLua.CheckObject <KBEngine.NetworkInterface>(L, 1);
         KBEngine.MemoryStream     arg0 = (KBEngine.MemoryStream)ToLua.CheckObject <KBEngine.MemoryStream>(L, 2);
         bool o = obj.send(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #6
0
        public void send(NetworkInterface networkInterface)
        {
            fini(true);

            if (networkInterface.valid())
            {
                for (int i = 0; i < streamList.Count; i++)
                {
                    stream = streamList[i];
                    networkInterface.send(stream.getbuffer());
                }
            }
            else
            {
                Dbg.ERROR_MSG("Bundle::send: networkInterface invalid!");
            }

            streamList.Clear();
            stream = new MemoryStream();
        }
		public void send(NetworkInterface networkInterface)
		{
			fini(true);
			
			if(networkInterface.valid())
			{
				for(int i=0; i<streamList.Count; i++)
				{
					stream = streamList[i];
					networkInterface.send(stream.getbuffer());
				}
			}
			else
			{
				Dbg.ERROR_MSG("Bundle::send: networkInterface invalid!");  
			}
			
			streamList.Clear();
			stream = new MemoryStream();
		}
        public void send(NetworkInterface networkInterface)
        {
            fini(true);

            if (networkInterface.valid())
            {
                for (int i = 0; i < streamList.Count; i++)
                {
                    MemoryStream tempStream = streamList[i];
                    networkInterface.send(tempStream);
                }
            }
            else
            {
                Dbg.ERROR_MSG("Bundle::send: networkInterface invalid!");
            }

            // 我们认为,发送完成,就视为这个bundle不再使用了,
            // 所以我们会把它放回对象池,以减少垃圾回收带来的消耗,
            // 如果需要继续使用,应该重新Bundle.createObject(),
            // 如果外面不重新createObject()而直接使用,就可能会出现莫名的问题,
            // 仅以此备注,警示使用者。
            reclaimObject();
        }
Exemple #9
0
        void sendImm(NetworkInterface networkInterface, uint fId)
        {
            fini(true);
            Debug.Log("message Number " + streamList.Count);
            //bool resp = false;
            if (networkInterface.valid())
            {
                for (int i = 0; i < streamList.Count; i++)
                {
                    stream = streamList[i];
                    networkInterface.send(stream.getbuffer(), delegate(Packet p) {
                        //par.packet = p;
                        //resp = true;
                    }, fId);
                }
            }
            else
            {
                Dbg.ERROR_MSG("Bundle::send: networkInterface invalid!");
            }

            streamList.Clear();
            stream = new MemoryStream();
        }