Re: Looking for information on MFC TCP Communication
- From: "Josh McFarlane" <darsant@xxxxxxxxx>
- Date: 18 Aug 2005 07:22:50 -0700
Joseph M. Newcomer wrote:
> Note that to use the MFC socket classes the separate threads must be UI threads, although
> there is rarely a need to use separate threads. Note that separate threads must not
> manipulate any windows owned by the GUI thread. Other than the obvious of using a UI
> thread instead of a worker thread, providing appropriate synchronization for shared
> objects, and not touching the GUI, there are no "thread issues". Synchronization and the
> GUI interactions are fundamental to ALL threading and not unique to sockets, and the UI
> thread is documented, so it isn't really an "issue".
> joe
Got the 'don't touch the GUI' part down. One part I don't understand is
why it needs a UI thread.
Do the notifications of received data and etc require a queue in order
to properly route to the CAsyncSocket? If so, is there anything I need
to do beyond just the using the UI thread to ensure that the
CAsyncSocket gets it's notifications? (Adding message handlers?)
The reason I thought about seperate threads was that I was just going
to have the sending thread block when there was no information to send
(using a constant loop with a queue system). Since the UI thread would
have a handler and a non-blocking socket, I can definately try to
consolidate them into one.
Ok, one more quick question. I'm going to have to have a buffer for
each image before I transmit it across the network. Normally, I'd just
allocate the buffer , but this may be allocating / deleting alot of
space for just a short period of use. Do you think that it might be
worth looking into using pools of Image Buffer objects rather than
new/delete-ing them on the spot? Allocation tends to be a big part of
my resource chokes, and using the pool method might help alliviate it,
but never used it before. Granted, I'm going to try it without and see
if it's necessary first, but I was just looking for any comments if you
guys have used it before.
Thanks again,
Josh McFarlane
.
- Follow-Ups:
- Re: Looking for information on MFC TCP Communication
- From: Scott McPhillips [MVP]
- Re: Looking for information on MFC TCP Communication
- References:
- Looking for information on MFC TCP Communication
- From: Josh McFarlane
- Re: Looking for information on MFC TCP Communication
- From: Joseph M . Newcomer
- Looking for information on MFC TCP Communication
- Prev by Date: RE: CWinApp Assertion failure/ Access violation in odbc32.dll
- Next by Date: Subclassing CWinThread
- Previous by thread: Re: Looking for information on MFC TCP Communication
- Next by thread: Re: Looking for information on MFC TCP Communication
- Index(es):
Relevant Pages
|