c++ - Variable sized packet -


i trying define packet length determined during ns-3 simulation (think of packet sent on downlink containing schedule information length depends on number of nodes in network can join/leave network during simulation). have idea how approach this?

the traditional solution send length first, followed data:

+------------+---------------------+ | uint32_t n | n - 4 bytes of data | +------------+---------------------+ 

to decode, read first 4 bytes, , use value in bytes determine how more data there is.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -