What is wrong with this?
The client initiates contact with the server and sends a single CMsg object
When the Server receives it this happens :
A reply of 8 messages
on the other sideCode:void CServerDlg::dealWithRecvdMsg(CMsg& msg) { CMsg msg; for ( int i = 0; i < 8; i++ ) { // a different msg each time SendPost(msg); // watch what happens when the Sleep time changes Sleep(1000); } }
the client receives them :
the messages are deserialized :Code:void CCliSock::OnReceive(int nErrorCode) { CSocket::OnReceive(nErrorCode); m_pParentdlg->PickUpPost(m_pArchiveIn); }
here the messages are taken apart and dealt with :Code:void CClientDlg::PickUpPost(CArchive* pArchiveIn) { CMsg msg; do { try { msg.Serialize(*pArchiveIn); } catch(CFileException e) { pArchiveIn->Abort(); AfxMessageBox(_T("Abort in CClientDlg.:PickupPost")); } if (pArchiveIn == NULL) break; } while (!pArchiveIn->IsBufferEmpty()); dealWithRecvdMsg(msg); }
If there is a 1000ms sleep time it worksCode:void CClientDlg::dealWithRecvdMsg(CMsg& msg) { // sort out the individual messages }
if there is a 500ms sleep time it works
but it there is a 5ms sleep time between transmissions It Doesn't Work
and I only am able to see the 1st and 8th message.
What am I doing wrong?




Reply With Quote