stream_set_byte_order stream_shutdown navigation bar

stream_set_swap_bytes

Determines whether the functions that send and receive t_short's, t_utf16_char's, t_utf32_char's, t_int's, t_long's, or arrays of them, swap the bytes in the individual values.

Description

Byte swapping is only necessary when communicating between processors that use a different endianness. For example, Intel processors are little endian (LSB first) while Motorola processors tend to be big endian (MSB first). By default, no byte swapping takes place. Whether byte swapping is necessary may be determined simply by sending 0x1234 as a short and seeing if it arrives as the same number or 0x3421.

Prototype

t_error
stream_set_swap_bytes(t_stream stream, t_boolean swap);
    

Parameters

t_stream stream

A stream established using stream_listen, stream_connect or stream_accept.

t_boolean swap

Non-zero to enable byte swapping, and zero to disable byte swapping.

Return value

Returns 0 on success. 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