Share via


Socket.Receive Method (Byte[], Int32, Int32, SocketFlags)

Receives data from a bound socket, according to specified flags, and places the data in a buffer array, beginning at a specified location in the buffer.

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

Syntax

public int Receive (
         byte[] buffer,
         int offset,
         int size,
         SocketFlags socketFlags
)

Parameters

  • buffer
    An array in which the received data is placed.
  • offset
    The location, relative to the beginning of the buffer array, where the storing of received data is to begin.
  • size
    The size, in bytes, of the buffer array. If the number of bytes received is greater than the size of the buffer array, the data is truncated so that it fits in the array.
  • socketFlags
    Bit flags that control the socket's behavior for sending and receiving data. The value of this parameter is a bitwise combination of members of the SocketFlags enumeration.

Return Value

The number of bytes received, if the call was successful; otherwise, -1.

Remarks

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

Socket Class
Socket Members
System.Net.Sockets Namespace