Dear all,

In my application I am using a TWSocket in a working thread for heavy traffic 
to/from server.  Since there is no window in thread the TWSocket requires the 
MessageLoop() to receive events.  My approach is when there is no data to send 
the TWSocket keeps to be looped within the MessageLoop(), processes received 
data in FClientDataAvailable.  When there are data to be sent, the main thread 
PostMessage(m_FClientSocket->Handle, WM_QUIT, 0, 0) to let it to call send 
method.

The problem is when the incoming data are received continually, the thread is 
not able to receive WM_QUIT from message queue at all, causing all outgoing 
data to be blocked.  I tried Sleep(10) in FClientDataAvailable and sometimes 
the MessageLoop can be broken, but not always.

Is there a better way to handle concurrent data transmit/receive in 
asynchronous TWSocket in thread?


Thanks in advance.
Patrick
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to