Re: Losing UDP packets with MFC Sockets

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



He is not saying use multiple inheritance, he is saying have a class derived
from CWinThread that owns the socket. And most likely after it receives the
data send it to the main thread for proccessing.

AliR.

"Vicent Soler" <VicentSoler@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:930B0ECC-DA85-4215-9971-8BF74145C428@xxxxxxxxxxxxxxxx
> I'm not sure about your thread solution:
>
> - Are you saying that I sould derive my class from both CAsyncSocket and
> CWinThread?? With this king of inheritage, the OnReceive notification will
be
> implemented in specific thread different from the main thread, right? If I
> want to access the derived class from the main thread, could exist any
> conflict? Should I use Critical Section in every method of the class?
Please,
> let me know any sample, if possible...
>
> Thanks, I hope it works...
>
> Vicent
>
> "Scott McPhillips [MVP]" wrote:
>
> > Vicent Soler wrote:
> > > Just two questions:
> > >
> > > 1.- The buffer size allows to store temporarly more than 1 packet? Or
it is
> > > related to the maximum packet size?
> > >
> > > 2.- About the thread: should I use threads for extracting data from
input
> > > buffer after OnReceive notification?
> > >
> > > Thanks in advance
> > >
> > > Vicent
> >
> > You will need to experiment and see if the buffer size makes any
> > difference. My guess is that it will not help.
> >
> > The CAsyncSocket object works in only one thread. Put all of its code
> > in a thread that you derive from CWinThread. Raise the thread's
> > priority. Call ReceiveFrom immediately in OnReceive.
> >
> > --
> > Scott McPhillips [VC++ MVP]
> >
> >


.