2.2.3.1.3 Length

Length is the size of the packet including the 8 bytes in the packet header. It is the number of bytes from the start of this header to the start of the next packet header. Length is a 2-byte, unsigned short int and is represented in network byte order (big-endian).

The Length value MUST be greater than or equal to 512 bytes and smaller than or equal to 32,767 bytes. The default value is 4,096 bytes.

Starting with TDS 7.3, the Length MUST be the negotiated packet size when sending a packet from client to server, unless it is the last packet of a request (that is, the EOM bit in Status is ON) or the client has not logged in.