/// <summary> /// Prepare to read and inflate incoming packet /// </summary> private void _AllocateIncomingPacket() { // Create a new incoming packet header IncomingPacketHeader = new TDSPacketHeader(new byte[TDSPacketHeader.Size]); // Reset header data position IncomingPacketPosition = 0; }
/// <summary> /// Create a new TDS packet in the message /// </summary> private void _CreateOutgoingPacket(TDSMessageType type, byte packetID) { // Allocate an outgoing packet in case it isn't available _AllocateOutgoingPacket(); // Allocate a new packet with the specified type and normal status OutgoingPacketHeader = new TDSPacketHeader(_outgoingPacket, type, TDSPacketStatus.Normal); // Assign session identifier to the packet OutgoingPacketHeader.SPID = OutgoingSessionID; // Increment packet identifier OutgoingPacketHeader.PacketID = packetID; }