Re: Losing UDP packets with MFC Sockets
- From: "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
- Date: Thu, 14 Apr 2005 18:13:09 -0500
Vicent Soler wrote:
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
I'm not saying use multiple inheritance. I'm saying, if you want to use a thread, you must use the kind that is derived from CWinThread. Put your socket into your thread as a member variable. Call the socket only from the thread. If you put the socket in such a thread you cannot access it or use it from the main thread.
What you can do is copy the received data to the heap and pass the heap pointer to the main thread using PostMessage to the main window.
-- Scott McPhillips [VC++ MVP]
.
- Follow-Ups:
- Re: Losing UDP packets with MFC Sockets
- From: Vicent Soler
- Re: Losing UDP packets with MFC Sockets
- References:
- Losing UDP packets with MFC Sockets
- From: Vicent Soler
- Re: Losing UDP packets with MFC Sockets
- From: Scott McPhillips [MVP]
- Re: Losing UDP packets with MFC Sockets
- From: Vicent Soler
- Re: Losing UDP packets with MFC Sockets
- From: Scott McPhillips [MVP]
- Re: Losing UDP packets with MFC Sockets
- From: Vicent Soler
- Losing UDP packets with MFC Sockets
- Prev by Date: why destructor is not called
- Next by Date: Re: extension dll linking with extension dll
- Previous by thread: Re: Losing UDP packets with MFC Sockets
- Next by thread: Re: Losing UDP packets with MFC Sockets
- Index(es):
Relevant Pages
|