<div>I add this code in doGetNextFrame():</div><div><br></div><div><div><font color="#3366ff"><span class="Apple-tab-span" style="white-space:pre"> </span>if (fMaxSize > fInputBufferSize) {</font></div><div><font color="#3366ff"><span class="Apple-tab-span" style="white-space:pre"> </span>fInputBufferSize = fMaxSize;</font></div>
<div><font color="#3366ff"><span class="Apple-tab-span" style="white-space:pre"> </span>delete[] fInputBuffer; fInputBuffer = new unsigned char[fInputBufferSize];</font></div><div><font color="#3366ff"><span class="Apple-tab-span" style="white-space:pre"> </span>*( reinterpret_cast<u_int32_t*>(fInputBuffer) ) = htonl(0x01);</font></div>
<div><font color="#3366ff"><span class="Apple-tab-span" style="white-space:pre"> </span>}</font></div><div><font color="#3366ff"> // Arrange to read data directly into the client's buffer:</font></div><div><font color="#3366ff"> fInputSource->getNextFrame ( fInputBuffer + 4, fMaxSize - 4,afterGettingFrame, this,FramedSource::handleClosure, this );</font></div>
</div><div><font color="#3366ff"><br></font></div><div>and this in afterGettingFrame1():</div><div><br></div><div><div><font color="#3366ff"><span class="Apple-tab-span" style="white-space:pre"> </span>fFrameSize = frameSize + 4;</font></div>
<div><font color="#3366ff"><span class="Apple-tab-span" style="white-space:pre"> </span>memmove(fTo, fInputBuffer, fFrameSize);</font></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font color="#3366ff">(...omitted code...)</font></div>
</blockquote><div><br></div><div>Although it works fine, but noticed that there is a memory copy which I think is redundant. I have tried to let fTo point directly to fInputBuffer, but that caused the <span style>generated data full of garbage. I don't known why. who will use fTo later and where is fTo's initialization?</span></div>
<div><br></div><div>Thanks again for your help!</div>