I am developing a client/server program and my client has to send messages to the server.
Sample message C structure:
struct Reg
sizeof(regn) gives size of your complete structure Registration, wheras sizeof(data) is size of pointer on your machine that is 4 bytes (data should be pointer of Registration type).
In expression:
memcpy(data, ®n, sizeof(regn));
^ ^
| value variable of struct type
is pointer
also notice in printf, . is used to access elements e.g. regn.multicastGroup.