Home > other >  Multiple loop to the background data, into a one-time all out
Multiple loop to the background data, into a one-time all out

Time:10-22

C language, specific also said is bad, he said roughly a scene, a great god analysis analysis,
Do a project, at the front desk to knock a command, this command is the while loop gain apmodel (one by one, each time to achieve, through a socket connection), the first is the first own input through the TLV encapsulated into the background, in the background through the for loop iterates through (only get one at a time), access to data through a socket connection back to the front desk, look to whether conform to the requirements, if required, break out the while loop; If do not conform to the requirements, and then through the back door of the socket to the background to get a data, it caused the socket communication times, affect the efficiency, to optimize communication once, now
My idea is: when the data to the background, through a for loop out everything, and then to encapsulate the, again through the socket that connect everything to the front desk, by the front desk again one by one,
Problem is coming, so the data is not the same as the name, length is different, how do you solve this package? What data has a header, this to the front desk, how should solve for pointer offset? Or say I get in the background data, only the structure of the name to assign a value to a buf, again good to encapsulate the buf to the front desk? If this is the case, the name length is not the same, then the packaging good solve, will not so good to get?
The one get apmodel background, whether to get a package, and then add the packaging good things to buf to the array?
I feel also expressed is not very good, have a great god look with a little,

Knock this scenario is that a command line access apmodel, but there will be a lot of, need to get out one by one, and get the name, and then give out, under the name of the configuration of the original case is a time to get a name, and then through the name to get data, can be simple, now want to take a name came to the front desk, and then to separate, and name, respectively, to get each configuration, this distinction is not clear how to get - -

CodePudding user response:

Define the data to be sent into the TLV structure, type, length, the value of the three variables together, basic can meet your requirements
  • Related