/// <summary> /// Tasks for the send <see cref="Thread" />. /// </summary> private void SendTask() { while (true) { while (this._sendQueue.TryDequeue(out SendItem item)) { NetSocket socket = item.Socket; NetPacket packet = item.Packet; packet.Encode(this._writeStream); socket.Send(this._writeStream.GetByteArray(), this._writeStream.GetOffset()); packet.Destruct(); this._writeStream.SetOffset(0); } Thread.Sleep(1); } }