B - & gt; Offset: 25 packages long: 200
C - & gt; Offset: 50 packet length: 200
D - & gt; Offset: 75 package long: 200
E - & gt; Offset: 100 package long: 200
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Group package nature ABCDE is received and then set in that order,
But to accept the order is not affected by the warranty,
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
So what do you think should be written in a efficient logic as far as possible, judge whether the set of packages to complete?
received a thrown into a queue, and then according to the fragment offset sort? After the row of computing:
If (0 * 8 + 200==25 * 200)
If (25 * 8 + 200==50 * 200)
.
Cycle?
every received a pack of doing so? How to feel low efficiency?
Felt very trouble,
Or I wonder, can you: received n sorted, n + 1 package somehow just inserted into the right position?
Or I thought again, I can: local group package, had got the 40 pieces, may be I received the first 2 and 4} {, {14, 15}, {30,31,32}, then I'll give him form 3 piece? This will be faster?
CodePudding user response:
How to ensure a continuous memory were visited again?CodePudding user response:
Haven't studied, reference how TCP??CodePudding user response:
Don't know how many predecessors in the TCP SocketSend (many) send (less) send (wealth)
Has been so much illness recv (), recv (wealth)
Inside the trap!
http://bbs.csdn.net/topics/380167545
CodePudding user response:
Finished, anyway just finished writing, I write this finished as a result, the ya get data out on see,Boy, to find, think of the TCP to points well, IP, in fact, almost no shard,
Cause the key to restructuring part of the code I wrote all didn't, also don't know if there is any bug
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The bosses to ask another question: I write IP restructuring program, take what to prove?
CodePudding user response:
Group package complete: with baotou bag end bag when you own transmission information, decide again?Test: broken network, transmission interrupt, interrupt reconnection, jam?
You see how