internal void SendInternalPacket(NetOutboundPacket packet, IPEndPoint to)
        {
            packet.RemovePadding();
            packet.SetId(AllocatePacketId());

            if (packet.Type == NetPacketType.ConnectionRequest)
            {
                NetEncryption.EncryptPacket(packet);
            }

            packet.PrependHeader();

            if (NetLogger.LogPacketSends && !IsPingPacket(packet.Type))
            {
                NetLogger.LogVerbose("[Outbound:{0}] {1}", to, packet.ToInternalString());
            }

            SendDataToSocket(packet.data, to, false);
        }
        void AddPacketToChunkQueue(NetOutboundPacket packet)
        {
            // If it is reliable we need to mark it as a new send
            TryMarkReliablePacket(packet);

            // Log send
            if (NetLogger.LogPacketSends && CanLogSend(packet.Type) && !IsPingPacket(packet.Type))
            {
                NetLogger.LogVerbose("[Outbound:{0}] {1}", EndPoint, packet.ToInternalString());
            }

            // Send packet or add it to queue
            if (packet.SendImmediately)
            {
                // Just send it if needed
                SendPacketToSocket(packet); // Send
            }
            else
            {
                // Try to add the packet to the chunked queue
                if (!packetChunkQueue.Add(packet))
                {
                    NetLogger.LogError(
                        "Failed to add packet to the chunk queue. Id: {0}, Type: {1}, DeliveryMethod: {2}, Duplicate Id Added: {3}",
                        packet.Id, packet.Type, packet.DeliveryMethod, packetChunkQueue.Contains(packet));
                }
                else
                {
                    // Increment the chunks current size
                    currentChunkSize += packet.Length;

                    // If the chunk is too big, send it before any other chunks are added
                    if (currentChunkSize >= maxChunkSize)
                    {
                        SendChunk();
                    }
                }
            }
        }