CAsyncSocket again

Started by
1 comment, last by Galileo430 22 years, 9 months ago
Here it goes.. For some reason.. Whenever I''m in a function or the focus is not set on the main window.. It refuses to receive messages. Anyone else have this problem, or know how to fix it?
------------------------------------------------------------I wrote the best video game ever, then I woke up...
Advertisement
Why do I think you need to multithread your app...?

In a single execution thread application, calling a function routes all processor time devoted to your function there. Even under Windows, your message loop is exactly that - a simple loop that handles incoming messages. You then try to respond to them as quickly as possible so as not to hold up the whole system. If you want to be able to call functions at will while responding to socket messages/connections/transmissions/whatever, you''re gonna need to place your socket code in a child thread.

I haven''t used CAsyncSocket (because I''m trying to write something reasonably portable here), but is it multithreaded? ie, does it somehow encapsulate a CThread object?

Good luck. I''ll let you know what I come up with.
Well, the problem is (I think) that because the socket is derived from a window handle it only that windows message loop can receve the data.

So I think I need a manual way to trigger that Windows message loop so it can call CAsyncSocket::OnRecieve()
------------------------------------------------------------I wrote the best video game ever, then I woke up...

This topic is closed to new replies.

Advertisement