> > See http://wiki.overbyte.be/wiki/index.php/Sending_and_receiving_data > > that discusses some possible data transfer modes.
> Thanks for that link. My code is for a transport layer that should not > make any assumption on what is transferred, so binary mode without any > line buffering is the way to go for me. Binary mode and line mode are not mutually exclusive. Just think about an "escape" mechanism. This mechanism will replace the delimiter (one or more byte) by another sequence. Easy. Also have in mind that binary data presentation is highly non portable. Byte order is different for even simple data types. Complex data types may have completely different binary representation. > It's the packets received before that indicate the length and all that, > but my layer does not know it. It is just being requested for N bytes to > be put in a given buffer. So if N is greater than what is available, > there is a problem anyway. Designing a whole system based on the assumption that you know from the beginning that you have to receive N bytes if bad design, imo. When speaking about telecommunication, you are mostly faced to an asynchronous mechanism. Taking that fact into account from start in the design will result in a much better system. You also have to think from start that you'll receive data in chunks (or blocks, or packets, whatever the name is) and you have no control on the chunk size, will result in a better system. Designing a system having in mind variable length data will result in a better system. Variable length can do fixed length easily, not the reverse. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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