stream_receive_byte stream_receive_byte_array navigation bar

stream_receive_bytes

Receives an array of bytes over a client stream.

Description

This function receives an array of bytes over a client stream. It has the same semantics as the stream_receive function.

Unlike the stream_receive_byte_array function, this function does not require that the stream receive buffer be at least num_elements bytes in length. Hence, it allow smaller stream buffers to be used.

Prototype

t_int
stream_receive_bytes(t_stream stream, t_byte * elements, t_uint num_elements);
    

Parameters

t_stream stream

A client stream established using stream_connect or stream_accept.

t_byte * elements

A pointer to a t_byte array in which the received data will be stored.

t_uint num_elements

The number of elements to receive, and available in the elements array.

Return value

The number of bytes received, which may be less than the requested number of bytes for non-blocking streams. If no more data is available and the connection has been closed gracefully then 0 is returned. If an error occurs then a negative error code is returned.

Error codes

This function does not return any error code.

Requirements

Include Files

Libraries

quanser_stream.h

quanser_communications.lib;quanser_runtime.lib;quanser_common.lib

See Also

 

navigation bar