Different machines have different byte storage order for variables, some use big-end mode (Big-endian), and some use small-terminal mode (Little-endian).
Big-endian mode means that high byte data is stored at a low address, and low byte data is placed at a high address.
Small-end mode means that low byte data is stored at a low address, and high byte data is placed at a high address.
Data transmission on the network, because the two ends of the data transmission may correspond to different hardware platforms, the use of the storage byte order may also be inconsistent, so the TCP/IP protocol on the network must use the network byte order (that is, big-end mode).
By analyzing the storage principle of the size end, it can be found that for char data, because it occupies only one byte, this problem does not exist, which is one of the reasons to define the data buffer as a char type in general. Non-char data, such as IP address, port number, and so on, must be converted to a big end mode before the data is sent to the network, and then converted to a storage mode that conforms to the receiving host after receiving the data.
So we need to change the data for the iOS to the big End storage::: T16 = Cfswapint16hosttobig (_api_ret);