Why use Open Client and Open Server datatypes?

There are two reasons why you should use Open Client and Open Server datatypes in your application rather than the native C datatypes: heterogeneous architecture, and portability of application code.

In a client/server application, data may be shared among machines with different architectures.

Open Client and Open Server datatypes provide a platform-independent representation for data that is transported between machines with different architectures. For example, if a client program is compiled and run on a machine that stores the bytes of integer values in a different order from the machine where the server is running, the bytes are swapped when CS_INT values are transported over a connection. For this reason, always use the correct CS_TYPEDEF to declare any variable that holds data to be sent to the server or read from the results of a server command.

Open Client and Open Server datatypes also permit application source code to be ported between platforms. For example, a CS_INT is always mapped to a system datatype that matches a 4-byte integer. Always use the correct CS_TYPEDEF to declare variables that are used in calls to Client-Library or CS-Library routines.