I used to send an struct with C++ sockets, and now I'm trying to use QTcpSockets instead. This is the struct:
const unsigned int uiMessageSize = 4;
typedef struct {
unsigned char uc_stx;
unsigned char uc_add;
unsigned char uc_state;
unsigned char uc_eot;
unsigned char uc_unused_padding[1024];
} st_message;
So then, for writing I used to call write(sockfd, &messageToSend, uiMessagePcToMastSize);
Now I'm trying with: socket->write(&messageToSend, uiMessagePcToMastSize);
and doesn't work: no matching function for call to ‘QTcpSocket::write(mastControl::st_messagePcToMast*, const unsigned int&).
I have searched more info, and looks like I should convert the struct to a QDataStrem, or just a QByteArray. I don't really know how to del with this.
Any help?