My Host is STM32l100 "Little Enidian"which is connected to a network processor LON:FT5000 "Big Enidian",communicates through UART ,how to over come this Problem of difference in Enidians.,one solution I know,interchange the bits before sending and receiving,any standard solution , as my app involves nested structure and enums)
The network protocol should define the endianness. For example, TCP/IP and Modbus are big endian. While CIP protocols such as DeviceNet are little endian. If you're creating your own protocol then choose whichever endianness is most convenient.
The software running on the network endpoints should convert the data appropriately. Note that this likely means swapping bytes rather than swapping bits.
See Introduction to Endianness for more information including this excerpt.
A common solution to the endianness problem associated with networking is to define a set of four preprocessor macros as shown in Listing 1. These macros are as follows:
htons(): reorder the bytes of a 16-bit unsigned value from processor order to network order. The macro name can be read "host to network short."
htonl(): reorder the bytes of a 32-bit unsigned value from processor order to network order. The macro name can be read "host to network long."
ntohs(): reorder the bytes of a 16-bit unsigned value from network order to processor order. The macro name can be read "network to host short."
ntohl(): reorder the bytes of a 32-bit unsigned value from network order to processor order. The macro name can be read "network to host long."