Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ReceiveBufferSize Property

ServicePoint.ReceiveBufferSize Property

Gets or sets the size of the receiving buffer for the socket used by this ServicePoint.

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

'Declaration
Public Property ReceiveBufferSize As Integer
'Usage
Dim instance As ServicePoint 
Dim value As Integer 

value = instance.ReceiveBufferSize

instance.ReceiveBufferSize = value

Property Value

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

ExceptionCondition
ArgumentOutOfRangeException

The value specified for a set operation is greater than MaxValue.

For additional information, see ReceiveBufferSize.

The following code example sets the value of this property.

Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.IO
Imports System.Threading
Public Class ServicePointExample

    ' Pass in the name of the Web page to retrieve. 
    Public Shared Sub Main(ByVal args() As String)
        Dim page As String 
        If args Is Nothing OrElse args.Length = 0 OrElse args(0).Length = 0 Then
            page = "http://www.contoso.com/default.html" 
        Else
            page = args(0)
        End If 

        Dim request As HttpWebRequest = CType(WebRequest.Create(page), HttpWebRequest)
        ' Get the service point that handles the request's socket connection. 
        Dim point As ServicePoint = request.ServicePoint
        ' Set the receive buffer size on the underlying socket.
        point.ReceiveBufferSize = 2048
        ' Set the connection lease timeout to infinite.
        point.ConnectionLeaseTimeout = Timeout.Infinite
        ' Send the request. 
        Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
        Dim responseStream As Stream = response.GetResponseStream()
        Dim s As New StreamReader(responseStream)
        ' Display the response.
        Console.WriteLine(s.ReadToEnd())
        responseStream.Close()
        response.Close()
    End Sub 'Main
End Class

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

ADD
Show:
© 2015 Microsoft