static int GetNetBytes(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); MsgBase obj = (MsgBase)ToLua.CheckObject <MsgBase>(L, 1); byte[] o = obj.GetNetBytes(); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private void LoopSending() { while (clientSocket != null && clientSocket.isConnect()) { lock (sendMsgPool) { while (sendMsgPool.Count > 0) { MsgBase msg = sendMsgPool.Dequeue(); clientSocket.AsyncSend(msg.GetNetBytes()); } } Thread.Sleep(100); } }