Resource Manager io_write handler.

Hello,

i need some help in this situation:

I have ‘n’ types of data that can be writed to the resource manager.
First, I have a “header structure” and some “info structures”. The client
always send a full message ( header + information ).

//Header Structure :
struct header {
int option;
int infosize;
};

// info structures
struct info1 {
int a;
int b;
int c;
};
struct info2 {
int a;
float b;
double c;
};

So, i want to do something like:
first, the resource manager reads the header structure,
based on header.option, the resource manager reads the 2nd part of msg using
the offset pointed to the end of the header,
store the bytes on the choosed structure.

1 - resmgr_msgread(ctp, &header, sizeof(header), [begin of header]);
2 - process_header();
3 - resmgr_msgread(ctp, &info1, sizeof(info1), [end of header]);
4 - process_info();

My tests was:
If the client sends only the header, all variables in header structure are
OK, but when the client send the full message, the header contains invalid
information, as if there’s some problem with the pointer.

So, what the best to do? Combine messages?

Leandro Colen