General string format for this protocol: length (1 byte) Actual description (length bytes) Client Send: add_contribution (1) type: 1 byte, 1 name: 20 bytes need_length: 1 byte answered_need: need_length bytes struct add_contribution { uint8_t type = 1; char name[20]; uint8_t need_length; char answered_need[255]; } __attribute__((packed)); // to send struct add_contribution my_food = {1, "Seth", 4, "fish"}; write(client_socket, &my_food, 1 + 20 + 1 + my_food.need_length); query_needs query_offers Server Send: accept_contribution remaining_needs accepted_offers