sendto using struct with a char*

I am trying to send a structure over the network using UDP using C. The structure has the following format: struct pck{ int size; int seq; char* data; } After I malloc the right amout of bytes for the data field (on both the sending and receiving end), the packet makes it over partialy. The problem stands at the receiving end. The data field does not make it over at all. The two other fields size and seq are consistent and are received ok. If I change the data from a char* to a char temp[somenum] array is works fine. But my app need this field to be dynamic. Any help with this will be appreciated. Thank you.

The size of your structure is 12 bytes (2 x 4 for the two integers plus 4 for character pointer). This is what you send if you set your buffer to structure address and the size to structure size (12 bytes). If you use array, of course, you send the full content. Two use structure, you have to send in two steps