-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Francois Piette wrote: > Your ReadFully won't work. You must think event driven. When OnDataAvailable > is triggered, you must > read data but you can't loop waiting for so much data to come. If you have > not received enough data, > just get thereceived data into a buffer and return from the event handler. > When the next > OnDataAvailable is triggered, you append the next data read into your buffer, > until you get enough > data. Basically, that's what LineMode is doing, until it has received a > complete line. >
OK. I understand what you're saying, which for me is a definite step up. That being said, when would I actually act on the data that I have received from the socket? If I have LineMode off, that means I have to either 1) look for a terminator or 2) accept <x> many bytes and then act on the information I have so far, correct? Again, as I've seen in archive here before, what happens if my information gets processed in two batches (packets)? When do I decide OK, enough is enough, and continue on processing? Is TWSocket neccessarily fit for binary-type protocols like Napster/ICQ/WASTE/etc with variable-length packets? > In addition, you have a memory leak: you allocate memory and never free it. > Yeah, I noticed that. Thanks for bringing it to my attention. That's like the 12th Commandment or something (the 11th being "Thou shalt not divide by zero!") :-) Cheers, Wesley -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (MingW32) iD8DBQFCnGYgB5TesQcz1CoRAkNCAKCvwJ9wxyJRvH+1aD6YCDaSFdiSsgCdHJM9 J+PTuWNJUGU2Fr81e+YwSoI= =jsDA -----END PGP SIGNATURE----- -- 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