RTL_TCP Commands

Steve Markgraf steve at steve-m.de
Tue Mar 26 14:16:50 UTC 2013


Hi,

On 26.03.2013 14:50, Chris Svendsen wrote:
> #define COMM_SET_FREQ ((unsigned char) 0x01)
> struct command{
>          unsigned char cmd;
>          unsigned int param;
> };
>      unsigned char cmds;
>      int iFreq = 500000000;
>      cmds = COMM_SET_FREQ;
>      struct command cmd = {cmds, htonl(iFreq)};
>
> answer = send(sConnect, (const char*)&cmd, sizeof(cmd), 0);

What's the sizeof(cmd), is it really 5? Seems like you're missing the
__attribute__((packed)) to make sure the members of the struct are
byte-aligned.

Regards,
Steve




More information about the osmocom-sdr mailing list