Re: Question about CSocket::Receive()
Fenster wrote:
I have a class derived from CSocket.
I have a vague recollection that I only get one shot at calling
Receive() in my override of OnReceive(). What I mean by that is that if
there's 2k of data to be read but I only read 1k when I call Receive()
then the other 1k gets lost.
Or can I call Receive() more than once within OnReceive() but after I
exit OnReceive() I lose any data that didn't read?
I can't remember where I've read this or something along those lines and
I can't see it in the documentation. It may be that I'm completely
mistaken and it's just my memory playing tricks on me.
Can anyone help me out with this? Thanks.
You should only call Receive once, but if you don't take all the data
that it has nothing is lost. If will just call your OnReceive again if
necessary.
I, too, would suggest CAsyncSocket instead of CSocket. CSocket has a
terrible reputation and does not fit in well with an event driven
application.
--
Scott McPhillips [VC++ MVP]