Archived

This topic is now archived and is closed to further replies.

TheTempest

Multithreaded AND async sockets...?

Recommended Posts

TheTempest    122
Hello, I've written a simple win32 console app that uses multithreading. The only problem is that the threads are not asyncronus. I'm not quite sure how to impliment the WSASelectAsnyc() fucntion into a mutltithreaded program due to the fact that you have to use the message pump for the window in a REAL windows program. Does ne1 have any snippets or links or general architecture for a program like this? I guess another way of asking is something i saw on a web site, something about using "WSARecv" and a "thread event"?? whats that about? THANKS "There are no such things as stupid questions... Just stupid people " -Me [edited by - TheTempest on October 3, 2002 9:45:49 AM]

Share this post


Link to post
Share on other sites
kuphryn    210
One solution is an event synchronization. You need to know when to read data and when to wait for data. That is one use of an event kernel object in a Winsock application.

For example, let say you get a notice from WSAAsyc of incoming data. After you start a new thread and read data, there are, however, still data left. One solution is to use an event to pause the worker thread from looping.

Kuphryn

Share this post


Link to post
Share on other sites