Socket.ReceiveBufferSize Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that specifies the size of the receive buffer of the Socket.

Namespace:  System.Net.Sockets
Assembly:  System.Net (in System.Net.dll)

Syntax

'Declaration
Public Property ReceiveBufferSize As Integer
public int ReceiveBufferSize { get; set; }

Property Value

Type: System.Int32
An Int32 that contains the size, in bytes, of the receive buffer. The default is 8192.

Exceptions

Exception Condition
ArgumentOutOfRangeException

The value specified for a set operation is less than 0.

SocketException

An error occurred when attempting to access the socket.

ObjectDisposedException

The Socket has been closed.

Remarks

A larger buffer size potentially reduces the number of empty acknowledgements (TCP packets with no data portion), but might also delay the recognition of connection difficulties. Consider increasing the buffer size if you are transferring large files, or you are using a high bandwidth, high latency connection (such as a satellite broadband provider.)

If you receive a SocketException, use the SocketException.ErrorCode property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.