Re: Something like "ping" for windows messages.
- From: "Peter Smithson" <Peter_Smithson@xxxxxxxxxxx>
- Date: 10 Dec 2006 01:54:47 -0800
Geoff Joy wrote:
If you are using MFC then it is not Win16, the old code might have been Win16
but you have now stepped outside that paradigm. Sending yourself WM_TIMER
messages was a way of assuring a message would arrive for your application in
Win16 since GetMessage was a yield of CPU to the OS. I suspect the original
application may have had some kind of polling it was doing, hence the timer.
Correct.
There are also some
issues to be aware of, depending on if you are using CSocket or CAsyncSocket.
Refer to the experts in winsock for advice there.
I've read a faq somewhere on sockets that wasn't very complementary
about CSocket. In this case, the server is using CAsyncSocket but the
article wasn't too happy about that either! In the past I've always
used Win32/socket calls and many threads so I'm on a learning curve
with MFC classes.
The HTTP server portion should run in it's own thread if you think it will impact the message pump.
I'm 99% sure a thread would help. Just trying to get a rough idea of
what the benefit might be and, if I did the work, if I helped matters.
Threads are great but I've found that adding them to a design after the
event can cause lots of headaches - lots of thread unsafe code around
sometimes. Those kinds of bugs are nasty to track down. So I only use
them when I know they're of benefit.
Use NETMON to sniff the wire to measure the latency in your TCP server.
This might help your probing:
Try starting the performance timer at the end of the message loop and stopping
at the start (with appropriate trapdoors of course) to see how long your process
was suspended. I have tested this in a simple hello world application and when
there are no messages the message loop remains idle and the idle time is
recorded by the timer when the next message arrives. (Mouse moves are 10ms, the
smallest message interval I saw was 16uS.)
I think I see what you're saying. My MFC knowledge is fairly basic.
How would I insert this code in the message loop? Isn't that hidden
away in the MFC library? If you have a simple hello world demo to hand
then perhaps that'd explain it best. My e-mail address is Peter dot
Smithson at gmail.com. Thanks.
I recommend letting the HTTP server idle out with no connections and see if it
blocks the message loop.
I'm not sure I've understood you there. If the http server isn't doing
anything then I'd have thought I'd be 100% gaurenteed that there'd be
no message loop being blocked. This http server is already built into
our server and the server certainly still works when there are no http
requests.
Thanks.
Peter.
.
- References:
- Something like "ping" for windows messages.
- From: Peter Smithson
- Re: Something like "ping" for windows messages.
- From: Joseph M . Newcomer
- Re: Something like "ping" for windows messages.
- From: Peter Smithson
- Something like "ping" for windows messages.
- Prev by Date: Re: Something like "ping" for windows messages.
- Next by Date: Help..about ISAPI onEndOfNetSession( )
- Previous by thread: Re: Something like "ping" for windows messages.
- Next by thread: Re: Something like "ping" for windows messages.
- Index(es):
Relevant Pages
|