Receives data from a connected VirtualSocket in a specific location of the receive buffer.
The number of bytes received.
This overload only requires you to provide a receive buffer. The offset defaults to 0, size defaults to the buffer length, and the socketFlags value defaults to None.
The Blocking determines the behavior of this method when no incoming data is available. When false, a SocketException is thrown. When true, this method blocks and waits for data to arrive. For Stream Socket types, if the remote Socket was shut down gracefully, and all the data was received, this method immediately returns zero, regardless of the blocking state.
If you are using a message-oriented Socket, and the message is larger than the size of the buffer parameter, buffer is filled with the first part of the message, and a SocketException is thrown. With unreliable protocols the excess data is lost; with reliable protocols, the data is retained by the service provider.
Note If you specify the OutOfBand flag as the socketFlags parameter, and the Socket is configured for in-line reception of out-of-band (OOB) data (using the OutOfBandInline option) and OOB data is available, then only OOB data is returned. When the Peek flag is specified as the socketFlags parameter, available data is copied into the receive buffer but is not removed from the system buffer.
Exception Type | Condition |
---|---|
ArgumentNullException | buffer is a null reference (Nothing in Visual Basic). |
SocketException | An operating system error occurs while accessing the VirtualSocket. |
ObjectDisposedException | The VirtualSocket has been closed. |
VirtualSocket Class | Org.Mentalis.Security.Ssl Namespace | VirtualSocket.Receive Overload List