System.Net.Sockets.SocketAsyncEventArgs.SetBuffer Method

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

Syntax

public void SetBuffer (int offset, int count)

Parameters

offset
The offset, in bytes, in the data buffer where the operation starts.
count
The maximum amount of data, in bytes, to send or receive in the buffer.

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 buffer array in the SocketAsyncEventArgs.Buffer property.

This method sets the SocketAsyncEventArgs.Count property to the count parameter and the SocketAsyncEventArgs.Offset property to the offset parameter. If the SocketAsyncEventArgs.Buffer property is null, this method ignores the offset and count parameters and sets the SocketAsyncEventArgs.Offset and SocketAsyncEventArgs.Count properties to 0.

This method does not change the SocketAsyncEventArgs.Buffer property.

Requirements

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