Re: CAsyncsocket derived class being run as a thread
- From: paul@xxxxxxxxxxx
- Date: 6 Jan 2006 08:29:06 -0800
Hi Joe and Scott,
Thanks for your replies - it will give me something to digest over the
weekend. A pity the kind souls at work haven't given me long enough to
actuall do any learning on the subject or testing. Sigh.
I did ask a rudimentary question about threading but its disappeared
from my news feed, so it
must have vanished. Anyway, what I asked was this:
If I do something like
pThread = AfxBeginClass (RUNTIME_CLASS (UDPListener)); // UDPListener
is derived from CWinThread
Can I access the member functions like this:
(UDPListener *) pThread->SetReceivePort( iPort); // set the listening
port
pThread->Start(); // start the thread going
If not, how can I access the thread functions?
Also, as you mention above, yes, I am using OnReceive(...) to receive
messages from the specified port. If I start a thread going, as
discussed above, will the UDP packets still be received? A friend at
work has written something in C# and suggested a while(true){ .... }
loop, with a call to UdpClient.Receive(...) placed in the middle of it
to pick up packets, but it just seems more natural (to me anyway!) to
let OnReceive(...) do everything rather than explicitly informing your
packet listener to do it in a loop.
.
- Follow-Ups:
- Re: CAsyncsocket derived class being run as a thread
- From: Joseph M . Newcomer
- Re: CAsyncsocket derived class being run as a thread
- From: Ian Semmel
- Re: CAsyncsocket derived class being run as a thread
- References:
- CAsyncsocket derived class being run as a thread
- From: paul
- Re: CAsyncsocket derived class being run as a thread
- From: Joseph M . Newcomer
- Re: CAsyncsocket derived class being run as a thread
- From: paul
- Re: CAsyncsocket derived class being run as a thread
- From: Joseph M . Newcomer
- CAsyncsocket derived class being run as a thread
- Prev by Date: Re: VS 2005
- Next by Date: Re: Venting on .NET
- Previous by thread: Re: CAsyncsocket derived class being run as a thread
- Next by thread: Re: CAsyncsocket derived class being run as a thread
- Index(es):
Relevant Pages
|