Re: Losing UDP packets with MFC Sockets
- From: "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
- Date: Fri, 15 Apr 2005 18:34:17 -0500
Vicent Soler wrote:
Hi AliR,
I think that this kind of implementation have a problem in my code:
1.- I'm using OLE Automation with two applications: the engine is written in VC++ and the GUI in VB.
2.- The UDP socket is not always open and depend on the working mode of the GUI. It means that the UDP socket can be open or closed many times during the application's life.
3.- To open/close the UDP socket the GUI calls a method from the Engine to proceed and then the engine processes the call and opens/closes the UDP socket. So, as you can imagine, I need a unique thread to manage UDP sockets because the GUI is waiting for the response. While the Engine is processing the call, the GUI is block waiting for the response and if after that the response is valid, the GUI continues with the operations.
4.- And another problem, how can I kill the thread from the main application once it is running.
Mmmmm.... Maybe I'm wrong but I don't see the solution you are defending. I'll try to investigate more...
Vicent
The thread is a CWinThread-derived object. It has a message map and you can post messages to it (PostThreadMessage and ON_THREAD_MESSAGE). When you want to kill the thread you post a user-defined message to it asking it to exit. The message handler in the thread is called, via the message map. It shuts down the thread by calling PostQuitMessage(0).
-- Scott McPhillips [VC++ MVP]
.
- 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
- 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: AliR
- Re: Losing UDP packets with MFC Sockets
- From: Vicent Soler
- Losing UDP packets with MFC Sockets
- Prev by Date: Drawing sideways bitmaps
- Next by Date: Re: changing the application name
- Previous by thread: Re: Losing UDP packets with MFC Sockets
- Next by thread: RE: Losing UDP packets with MFC Sockets
- Index(es):
Relevant Pages
|