csocket create

场景:CSOCKET Create异常

CSOCKET Create错误

C/C++ code
UINT _ListenTcpThread(LPVOID lparam)
{
    CServerDlg* pDlg = (CServerDlg*)lparam;
    CSocket sockSrvr;
    int detect;
    detect = sockSrvr.Create(8888);
    if( detect == 0)
    {
        AfxMessageBox("_ListenTcpThread Create错误!");
        return -1;
    }

编译正常,无错误
调试时,运行到CREATE的位置提示错误
microsoft visual c++ debug library
debug assertion failed! 

错误的位置
C/C++ code

void* CMapPtrToPtr::GetValueAt(void* key) const
// find value (or return NULL -- NULL values not different as a result)
{
    [b]ENSURE(this);[/b]

    if (m_pHashTable == NULL)
        return NULL;


------解决方案--------------------
BOOL CMyApp::InitInstance()
{
//Default Application Wizard code.
if(!AfxSocketInit())
AfxMessageBox("Failed to Initialize Sockets",MB_OK| MB_ICONSTOP);
return CWinApp::InitInstance();
}

------解决方案--------------------
CSOCKET学习一下 等懂的人来
------解决方案--------------------
你还不是不要在线程函数中操作CSocket类对象了吧。。。