stream_close_all End of trail navigation bar

stream_create_memory_stream

Creates a "memory stream" that may be used to read from or write to a buffer in memory instead of a communication channel.

Description

This function creates a "memory stream" that may be used to read from or write to a buffer in memory instead of a communication channel. Send and receive buffers are still used for parsing the buffer contents and so they should be treated as they would be for any other communication channel.

Memory streams never block so there is no non-blocking argument.

Prototype

t_error
stream_create_memory_stream(void * memory, size_t memory_size, t_int send_buffer_size, t_int receive_buffer_size, t_stream * client_stream);
    

Parameters

void * memory

The memory buffer from which to read or to which to write.

size_t memory_size

The size of the memory buffer invites. The stream_receive functions will never read past this length. The stream_send functions will never write past this length.

t_int send_buffer_size

The size of the buffer to use for sending data over the stream, in bytes.

t_int receive_buffer_size

The size of the buffer to use for receiving data over the stream, in bytes.

t_stream * client_stream

A pointer to a t_stream variable in which the client stream handle will be stored.

Return value

Returns 0 on success. If an error occurs then a negative error code is returned.

Error codes

QERR_WOULD_BLOCK

The connection request would block.

Requirements

Include Files

Libraries

quanser_stream.h

quanser_communications.lib;quanser_runtime.lib;quanser_common.lib

 

navigation bar