I have a data structure that looks like this:
typedef struct { unsigned short m_short1; unsigned short m_short2; unsigned char m_character; } MyDataType;
I suspect you'll want to archive to memory first, and then write that to the socket.