I want to discuss about openssl write and read method.
Assume I have an data structure like below:
/-----------------------------------------------------\\ | my_
If you're building an encrypted protocol, that's exactly how I'd do it, assuming my_header
contains enough information and nothing that in itself needs to be kept secure, such as the session key. Network packets at the low level (see tcpdump/libpcap) are just a char* ("string") and you extract different headers by moving along the array different lengths - what you're suggesting sounds just like this.