Compartir a través de


SocketAsyncEventArgs.SetBuffer Method (array<Byte[], Int32, Int32)

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

Sets the data buffer to use with an asynchronous socket method.

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

Syntax

'Declaration
Public Sub SetBuffer ( _
    buffer As Byte(), _
    offset As Integer, _
    count As Integer _
)
public void SetBuffer(
    byte[] buffer,
    int offset,
    int count
)

Parameters

  • buffer
    Type: array<System.Byte[]
    The data buffer to use with an asynchronous socket method.
  • offset
    Type: System.Int32
    The offset, in bytes, in the data buffer where the operation starts.
  • count
    Type: System.Int32
    The maximum amount of data, in bytes, to send or receive in the buffer.

Exceptions

Exception Condition
ArgumentException

There are ambiguous buffers specified. This exception occurs if the Buffer property is also not null and the BufferList property is also not null.

ArgumentOutOfRangeException

An argument was out of range. This exception occurs if the offset parameter is less than zero or greater than the length of the array in the Buffer property. This exception also occurs if the count parameter is less than zero or greater than the length of the array in the Buffer property minus the offset parameter.

Remarks

The offset and count parameters can't be negative numbers. The combination of the offset and count parameters must be in bounds of the data array in the buffer parameter.

This method sets the Buffer property to the buffer parameter, the Count property to the count parameter, and the Offset property to the offset parameter.

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.