public void AddToSendingQueue(Packet packet)
 {
     try
     {
         PacketWrite.Enqueue(packet);
     }
     catch (IndexOutOfRangeException ex)
     {
         Thread.Sleep(40);
         this.AddToSendingQueue(packet);
     }
 }
 public void PutPacket(Packet packet)
 {
     try
     {
         PacketRead.Enqueue(packet);
     }
     catch (IndexOutOfRangeException ex)
     {
         Thread.Sleep(40);
         this.PutPacket(packet);
     }
 }