Mono Class Library: System.Net.Sockets.Socket Overview | Members

System.Net.Sockets.Socket.Receive Method

Receives data from a socket.

public int Receive (byte[] buf, int size, SocketFlags flags)

Parameters

buf
Documentation for this section has not yet been entered.
size
A int containing the number of bytes to receive.
flags
Documentation for this section has not yet been entered.

Returns

A int containing the number of bytes received.

Permissions

TypeReason
System.Net.SocketPermissionRequires permission to accept connections. See System.Net.NetworkAccess.Accept.

Exceptions

TypeReason
ArgumentNullExceptionbuffer is null.
ArgumentOutOfRangeException

size < 0.

-or-

size > buffer.Length.

InvalidOperationExceptionAn asynchronous call is pending and a blocking method has been called.
System.Net.Sockets.SocketException

socketFlags is not a valid combination of values.

-or-

An error occurred while accessing the socket.

Note: For additional information on causes of the SocketException, see the System.Net.Sockets.SocketException class.

System.Security.SecurityExceptionA caller in the call stack does not have the required permissions.
ObjectDisposedExceptionThe current instance has been disposed.

Remarks

This method is equivalent to Socket.Receive(Byte[], int, SocketFlags)(buffer, 0, size, socketFlags).

Requirements

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