Share via


Socket.ReceiveFrom Method (Byte[], Int32, SocketFlags, EndPoint)

Receives data from an unbound socket, according to specified flags, and places the data in a buffer array. This method also gets the data's endpoint.

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

Syntax

public int ReceiveFrom (
         byte[] buffer,
         intsize,
         SocketFlagssocketFlags,
         ref EndPointremoteEP
)

Parameters

  • buffer
    An array in which the received data is placed.
  • size
    The size of the buffer array, in bytes. 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.
  • remoteEP
    An EndPoint object that, when this method returns a value, specifies the address of the socket from which the data was received.

Return Value

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

Version Information

Available in .NET Micro Framework version 2.0, 2.5

See Also

Reference

Socket Class
Socket Members
System.Net.Sockets Namespace