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); } }
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); }
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(); }
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(); }
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)); } }
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(); }
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(); }