> if a client on a LAN sends a packet with e.g. 512 Bytes and TCP splits > it up internaly to e.g. 4x128 Bytes will the receiver get 4x the > OnDataAvailable event, or 1x with the whole 512 Byte?
You can't predict. The only thing which is sure is that you'll receive all data in correct order. Packet fragmentation (or merging) depends on a lot of factors. One being your application. If it is slow processing packets, winsock continue to receive packets in the bacground, fill his buffer (8KB by default) and will deliver as much as possible at once. > So needs the sender to have a larger buffer to be able to concatenate > such packets before he can check and process them? You mean the receiver ? > if yes, has anybody a ringbuffer implementation he would share? You may use a simple GetMem and RellocMem to enlarge the buffer should it become too small. Be aware that ReallocMem may copy your data in another location. > Otherwise I'm toying with the idea to use a string as buffer so > I can add chars and delete some from > the beginning of the buffer as needed, Using string is a bad idea. Performance will not be there ! Avoid moving data around. Use pointers (or index in an array). That will be efficient. > but I don't know whether memory > fragmentation is a issue here (D2006 with FastMM). Fragmentation will always exists. No matter how intelligent is the memory manager. You should always think about what you do with your data. The less you move it around, the faster will be your program. Avoid allocating/freeing memory too frequently. Reuse allocated memory as much. If you want your code to be portable to .NET, use "array of byte" as much and use integer index to the array. For easy use, define "TBytes = array of bytes;". Avoid GetMem/FreeMem/ReallocMem , FillChar, Move and the likes. Avoid building strings character by character, this is incredibly inefficient in .NET (StringBuilder class has been created for such handling). -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be -- 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