#define MAXLINE 250 /* * Without "packed" the compiler will insert * padding into the struct. Remove it and * see what happens; printf( "%p %p\n", &req.pow, &req.num ) * will show you what the pointer values are. */ struct request { uint8_t pow; uint32_t num; } __attribute__((packed)); struct response { uint8_t status; uint32_t result; uint16_t len; char str[MAXLINE]; } __attribute__((packed));