As the sizeof(struct) may give different value between client and server programs, how do i align properly for boundary conditions.
You cannot unless the application is only used on platforms with exactly the same programming model i.e. LP64, IPL32, LP16, etc. You need to select a data interchange format and then encode or decode to that format.
Actually, both the client and server programs are running on solaris SPARC arch and I'm doing:
client side: write(fd,req_structure,sizeof(req_structure));
server side: read(fd,req_structure,sizeof(req_structure));
Do I really need to worry about the data exchange format?
Because one of my friend told me to ALIGN the structure on 1K boundary on server program. Because if the structure starts at odd address, read may fail on some systems. Could you please clarify...