hi
i have developed a server socket program which keeps on sending message. i have created a seperate thread using afxbeginthread(SendMsg,this) (this points to the CSocket derived class). im using carchive. the problem is when the thread tries to send messaage i get a debug assertion error.
i dont know what is the cause of the problem.

UINT SendMS(LPVOID lp)
{
CServerSock* pSock=(CServerSock*)lp;
do
{
pSock->SendStatus();// here i get error

Sleep(1000);
}while(pSock->m_pDlg->m_sta);
return 1;
}


void CServerSock::SendStatus()
{
m_pDlg->Serialize(*m_pArOut);
m_pArOut->Flush();

}

when i press retry i goes to base class

void CAsyncSocket::AssertValid() const
{
CObject::AssertValid();
ASSERT(m_hSocket == INVALID_SOCKET || CAsyncSocket::FromHandle(m_hSocket) != NULL);
}


outside the thread im able to send the message. i would be happy if u can help me with this problem
regards
aswin