Read data from the socket and store it in a byte array, but do not remove the data from the socket buffers.
A byte array that the data will be stored in.
An integer value which specifies the number of bytes actually read from the socket. A return value of zero specifies that there is no data available to be read. If an error occurs, a value of -1 is returned and the application should check the value of the LastError property to determine the cause of the failure.
The Peek method returns data that is available to read from the socket, up to the number of bytes specified. The data returned by this method is not removed from the socket buffers. It must be consumed by a subsequent call to the Read method. The return value indicates the number of bytes that can be read in a single operation. However, it is important to note that it may not indicate the total amount of data available to be read from the socket at that time.
If no data is available to be read, the method will return a value of zero. Using this method in a loop to poll a non-blocking socket can cause the application to become non-responsive. To determine if there is data available to be read, use the IsReadable property.
SocketWrench Class | SocketTools Namespace | SocketWrench.Peek Overload List