Admin Production ni-theme
Current Publication

CNSReadMultipleScalar

LabWindows/CVI

CNSReadMultipleScalar

int CNSReadMultipleScalar (CNSEndpoint endpointID, int timeout, void *array, size_t numElements, size_t *numElementsRead);

Purpose

Reads multiple scalar data items from a network stream. You can call this function from the reader endpoint only.

You must pre-allocate memory for array based on the scalar size and numElements you passed to the function.

Parameters

Input
Name Type Description
endpointID CNSEndpoint The handle of a network stream endpoint. You can obtain this handle using the CNSNewScalarEndpoint function.
timeout int The time, in milliseconds, that this function waits for the data to be available in the buffer. The default value is CNSWaitForever, which means this endpoint waits indefinitely. If the timeout expires, this function returns an error.
numElements size_t The number of scalars you want to read from the network stream.
Output
Name Type Description
array void The array of scalar elements that this function reads from the stream. This function sets the elements in the array to NULL if an error occurs.
numElementsRead size_t The total number of scalars that the function actually read from the network stream.

Note Note  numElementsRead is different than numElements if the writer endpoint was discarded and there are still elements in the reader buffer, but numElements is greater than the number of elements that remain in the buffer. After the function reads the remaining elements in the buffer, it returns the number of elements read in the numElementsRead parameter.
You can pass NULL for this parameter.

Return Value

Name Type Description
error int An error code returned by a Network Streams Library function.

Additional Information

Library: Network Streams Library

Include file: cvinetstreams.h

LabWindows/CVI compatibility: LabWindows/CVI 2013 and later