System.Data.SqlClient.SqlConnection.PacketSize Property

Gets the size (in bytes) of network packets used to communicate with an instance of ssNoVersion.

Syntax

[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public int PacketSize { get; }

Value

The packet size, in bytes.

Remarks

If an application performs bulk copy operations, or sends or receives lots of text or image data, a packet size larger than the default may improve efficiency because it causes fewer network read and write operations. If an application sends and receives small amounts of information, you can set the packet size to 512 bytes (using the Packet Size value in the SqlConnection.ConnectionString), which is sufficient for most data transfer operations. For most applications, the default packet size is best.

SqlConnection.PacketSize may be a value in the range of 512 and 32767 bytes. An exception is generated if the value is outside this range.

Setting the default value to a number greater than 8000 will cause the packets to use the MultiPage allocator on the instance of ssNoVersion instead of the much more efficient SinglePage allocator, reducing the overall scalability of the ssNoVersion. For more information on how ssNoVersion uses memory, see tp://go.microsoft.com/fwlink/?LinkId=143705 in ssNoVersion Books Online.

Requirements

Namespace: System.Data.SqlClient
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0