System.Net.Sockets.TcpClient.SendBufferSize Property

Gets or sets the size of the send buffer.

Syntax

public int SendBufferSize { get; set; }

Value

The buffer size.

Remarks

The TcpClient.SendBufferSize property gets or sets the number of bytes that you are expecting to send in each call to the NetworkStream.Write(Byte[], int, int) method. This property actually manipulates the network buffer space allocated for send operation.

Your network buffer should be at least as large as your application buffer to ensure that the desired data will be stored and sent in one operation. Use the TcpClient.SendBufferSize property to set this size. If your application will be sending bulk data, you should pass the NetworkStream.Write(Byte[], int, int) method a very large application buffer.

If the network buffer is smaller than the amount of data you provide the NetworkStream.Write(Byte[], int, int) method, several network send operations will be performed for every call you make to the NetworkStream.Write(Byte[], int, int) method. You can achieve greater data throughput by ensuring that your network buffer is at least as large as your application buffer.

Requirements

Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0