Wilfried Mestdagh wrote: > Hello Olivier, > > >> The NotifyDataAvailable sets a flag in an object associated to the >> client socket that will then read the available bytes. But it will not >> do so immediately >> > > That's the problem. You have to read "all" available data "In" the > OnDataAvailable event. If you do not then OnDataAvailable will fire > again in a loop where you must receive the rest of the data, or if you > set wsoNoReceiveLoop in ComponentOptions property then it is fired using > a custom message handler. > That's what I thought, but then again, this means I need to have a buffer of my own, and I have no idea which size it should be. 1k, 10k, more?
> So the Sleep is not needed. Also it is a bad idea because if there is > high speed data received and more than will be received in the event it > will delay the reception of data during a time slice (10..20 millisec > depending on the OS) and will grow winsock internal receive buffer, > because during the Sleep the message pump is not working. > I know that, but with 100%CPU usage, the handling of messages is stopped anyway as well as no other thread will be able to take control. Well, maybe on a multi core, but not on single core machines. -- 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