> So I ignored the zero und -1 returned by the Receive(), and it worked :)
Great ! I'm glad it works for you :)
> But the "TempSize" in my code was never changed. it was set as to a
> constant value en the constructor.
Ok no problem then. But if your buffer has a constant size, then wy not
put it on the stack like this:
Buffer: array[0..TempSize] of char;
// receive in buffer
> decrease the GetMem(), Free() as much as possible.. so I think I'll do
> it before the first request, and free it after the last request...
Yes that's another option. Then you only have 1 time allocation, but see
> for reassembling the original stream, what do you think ? "consecutive
> Realloc()" (First scenario) or "Array of pointer" (Second scenario)?
Difficult to say wahts best because it is depending on what you exacly
wants or have to do with it.
- if you have to save it to a file then you can:
- open the file at first packet
- receive in buffer
- write buffer direkt to file
- close file at last packet
-- the most fast is to use the low level routines: FileOpen(), etc...
- TFileStream is another option, somewhat slower
- if you have to do other things with it then you can
- use a TMemoryStream
- or a dynamicly allocate buffer that you take care yurself
Both of course will reallocate when data grow, however you can for
both options set the size at first, then also only 1 memallcoation and
- array of pointer seems more difficult. Dont think you will have
advantage using it.
Rgds, Wilfried [TeamICS]
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be