public void SendThread() { while (IsActive && socket.Connected) { if (sendQueue.Count > 0) { for (int i = 0; i < 1000 && sendQueue.Count > 0; i++) { qLuaPacket packet; if (sendQueue.TryDequeue(out packet)) { try { stream.Write(packet.id); stream.Write(packet.data.Length); stream.WriteRaw(packet.data); } catch (Exception ex) { plugin.log.Info("qlay->socket", "Error: " + ex.Message); Close(); } } } } Thread.Sleep(1); } }
public void WriteBool(bool value) { stream.Write(value); }