kharandir
asked on
Accept() give me an assertion fail
Hi,
I made two programs using the CSocket. When the server execute the Accept(), I have an assertion fail. If I ignore it, the communication works anyway but it's annoying. Here is the code
void CSockSvr::OnAccept(int nErrorCode)
{
BOOL Option = TRUE ;
CString s ;
if (m_Connection != NULL)
{
m_Connection->ShutDown(bot h) ;
m_Connection->Close() ;
delete m_Connection ;
}
m_Connection = new CSockCon ;
m_Connection->Create() ;
m_Connection->SetSockOpt(S O_REUSEADD R,&Option, sizeof(BOO L),SOL_SOC KET) ;
if(!m_Server->Accept(*m_Co nnection)) // ASSERTION FAIL
{
s.Format("Error accepting the communication (%d).",GetLastError());
AfxMessageBox(s);
}
else
{
TRACE("Communication accepted\n") ;
}
//CSocket::OnAccept(nError Code);
}
Can someone help me ?
Thanks in advance.
I made two programs using the CSocket. When the server execute the Accept(), I have an assertion fail. If I ignore it, the communication works anyway but it's annoying. Here is the code
void CSockSvr::OnAccept(int nErrorCode)
{
BOOL Option = TRUE ;
CString s ;
if (m_Connection != NULL)
{
m_Connection->ShutDown(bot
m_Connection->Close() ;
delete m_Connection ;
}
m_Connection = new CSockCon ;
m_Connection->Create() ;
m_Connection->SetSockOpt(S
if(!m_Server->Accept(*m_Co
{
s.Format("Error accepting the communication (%d).",GetLastError());
AfxMessageBox(s);
}
else
{
TRACE("Communication accepted\n") ;
}
//CSocket::OnAccept(nError
}
Can someone help me ?
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.