After doing a quick search on what socket->writeDatagram()
actually expects (see docs) it seems that there are two overloaded functions with this name. One that expects a const char* and a size, and the other that expects a QByteArray reference. In both cases this means that you need to pack your structure into these formats and unpack them into a structure on the other end. So in the case of the const char* create a character array that is the right size for your structure
unsigned int size=sizeof(int)+sizeof(bool)+sizeof(char)
char cBuffer[size];
and pack it like so
unsigned int nPos=0;
memcpy(cBuffer[nPos],envoie.test1,sizeof(int));
nPos+=sizeof(int);
memcpy(cBuffer[nPos],envoie.test2,sizeof(bool));
nPos+=sizeof(bool);
memcpy(cBuffer[nPos],envoie.test3,sizeof(char));
The second form of the function might have some nicer way to pack things but I am not familiar with Qt so you would have to look it up to see how it does it and whether it is nicer than the option I have given above. With the option I have given you also need to be careful about endianess if both machines don't have the same endianness they can switch the order in which they interpreter the bytes. This is most important for integer types. Types that are one character in length (i.e. char) will not be a problem, and it seems that often floating point numbers are also not a problem (though don't quote me on this). The QtByteArray might be a little nicer to work with, but a quick browse through the documentation on it doesn't seem to say anything about handling different endiannesses. The generally way to handle different endiannesses is to convert things to network byte order, or big endian byte order. There are likely some functions to convert your integers from your native endianness to the network byte order, and back to a native endianness on the other end.