Returns whether the methods that send and receive various data types,
or arrays of types, swap the bytes in the individual values in order to
account for endian differences between the client and server.
Namespace:
Quanser.CommunicationsAssembly: Quanser.Communications (in Quanser.Communications.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Function GetSwapBytes As Boolean |
C# |
---|
public bool GetSwapBytes() |
Visual C++ |
---|
public: bool GetSwapBytes() |
JavaScript |
---|
function getSwapBytes(); |
Remarks
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.
Examples
This example determines whether the stream is swapping bytes.
C# | Copy Code |
---|---|
isSwapping = stream.GetSwapBytes(); |
Visual Basic | Copy Code |
---|---|
isSwapping = stream.SetSwapBytes() |
Visual C++ | Copy Code |
---|---|
isSwapping = stream->GetSwapBytes(); |
Exceptions
Exception | Condition |
---|---|
Quanser.Communications..::.StreamException | If stream is invalid then an exception is thrown. This situation should never occur unless the underlying stream has been closed. |