Hi,
I'm trying to write raw data thorugh TCPSocket. I have a struct like (Modbus protocol):
//Modbus header
typedef struct MB_Request
{
uchar function_code;
quint16 start_adr;
quint16 quantity_regs;
};
//Modbus/TCP header, containing the Modbus header
typedef struct MBAP_Header
{
quint16 transaction_id;
quint16 protocol_id;
quint16 len;
uchar unit_id;
};
typedef struct MB_Message
{
MBAP_Header mb_hdr;
MB_Request mb_req;
};
//Modbus header
typedef struct MB_Request
{
uchar function_code;
quint16 start_adr;
quint16 quantity_regs;
};
//Modbus/TCP header, containing the Modbus header
typedef struct MBAP_Header
{
quint16 transaction_id;
quint16 protocol_id;
quint16 len;
uchar unit_id;
};
typedef struct MB_Message
{
MBAP_Header mb_hdr;
MB_Request mb_req;
};
To copy to clipboard, switch view to plain text mode
What I don't know is how to send a variable (MB_Message type) as raw data. The documentation show that the data have to be stored as "char *". How have I to do this?
Thanks,
Bookmarks