struct tMessage
{
int iFromUser;
int iFlags;
string szMessage;
};
class CClient
{
public:
Execute();
vector<tMessage> *pMsgQueue;
};
class CServer
{
public:
CServer() {}
~CServer() {}
Startup(...);
....
private:
ClientData
vector<tMessage> MessageQueue;
};
CServer::Startup(...)
{
ClientData = new CClient[iMaxConn];
for (int i = 0; i < iMaxConn; i++)
ClientData[i].pMsgQueue = &MessageQueue
}
CClient::Execute()
{
//other shutdown code
pMsgQueue->push_back(Msg); // Push in msg queue
return (0);
}
My Site