Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: problem with socket blocking when broadcasting message

0 views
Skip to first unread message

Konstantin

unread,
Oct 25, 2004, 2:58:34 PM10/25/04
to
From SDK help :
"SendMessage calls the window procedure for the specified window and does
not return until the window procedure has processed the message. The
PostMessage function, in contrast, posts a message to a thread's message
queue and returns immediately. "
So when you call SendMessage - you call window function directly, so you can
access same data from different threads and if you don't use critical
section it may lead to some problems.

> I create a server socket in a work thread, and then send broadcast message
> in the main thread after server socket waiting connection. As a result,
> sending message is blocked.
>
> I try redoing it in PC(win2k). It works perfectly. Then, I replace
> SendMessage with PostMessage, but no problem.
>
> Thanks for any help!
>
> BTW: partial test source code in attachment.
>
>
>
>


mortal

unread,
Oct 26, 2004, 4:55:39 AM10/26/04
to
Nothing but socket is used in the working thread. So, I think the critical
section is not necessary. And if I send the message to the other window( not
broadcast ), it is ok.

Thanks for your help in anyway!

0 new messages