Wilfried, > >> 3. Put a loop in my DataAvailable event that will do a Receive until I >> get -1 back. This would probably be the easiest to implement for me. > > No never do that. Don't set wsoReceiveLoop. If something is still (or > again) in receiving winsock buffer when you leave OnDataAvailable then > it will trigger again in a loop. >
If I don't set wsoNoReceiveLoop, then AsyncReceive loops continually calling my OnDataAvailable event. This would be fine if winsock did not put more FD_Read messages in the queue when I don't receive all the data. The problem I'm facing is that on very large transfers, winsock is flooding the queue with these FD_Read messages which produce extra and pointless calls to OnDataAvailable. This is what I'm trying to correct. So, the way I see it, I either have to set wsoNoReceiveLoop and let each FD_Read message produce a single call to my OnDataAvailable event, or I need to let AsyncRecieve loop and somehow tell winsock to not produce the extra FD_Read messages. What produces the fastest transfers and how would I set it up? >> All in all, speed is my main interest here. I want to read in all the >> data the server is sending me as fast as possible. > > - if possible move the data direcly where it belong, not copy it first in > a buffer as you do now. If you have to buffer it in between for some > reason make it as large as possible (make a little test case to see > how large receiving packets will be in a real world test). > - if you move direcly where it belong then you have to receive only what > you need of course. but no worry OnDataAvailable will trigger again > immediatly. I think you misunderstand me. My OnDataAvailable event is calling Receive to read in the data and then that data is processed. The only way I can process it is to read it in. I'm not saving this data to a file on the hard drive or anything. So, I don't know what you mean by "move the data directly where it belongs". Thanks, Jake -- Jake Traynham Owner, CNS Plug-ins http://www.cnsplug-ins.com/ -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be