UINT StationListenThread(LPVOID pParam)
{
CKGEDoc* pDoc;
CListenSocket* m_pListen;
CString strMsg;
BOOL bOk = FALSE;
UINT m_uPort;
pDoc = (CKGEDoc*)pParam;
m_uPort = pDoc->m_uPort;
m_pListen = new CListenSocket(pDoc);
if ( m_pListen )
{
pDoc->m_LogStr.Format("%u",pDoc->m_uPort);
if ( m_pListen->Create(168, SOCK_STREAM, FD_ACCEPT)) // 出错行
{
bOk = m_pListen->Listen();
}
if ( !bOk )
{
int nErr = m_pListen->GetLastError();
if ( nErr == WSAEADDRINUSE )
{
strMsg.Format(IDS_LISTEN_INUSE, pDoc->m_uPort);
}else
{
strMsg.Format(IDS_LISTEN_ERROR, pDoc->m_uPort);
}
AfxMessageBox( strMsg, MB_OK|MB_ICONSTOP );
m_pListen->Close();
delete m_pListen;
m_pListen = NULL;
}
while(true)
{
}
}else
{
AfxMessageBox( IDS_CANT_LISTEN, MB_OK|MB_ICONSTOP );
}
return 0;
}
提示错误所处的函数:void* CMapPtrToPtr::GetValueAt(void* key) const
// find value (or return NULL -- NULL values not different as a result)
{
if (m_pHashTable == NULL)
return NULL; UINT nHash = HashKey(key) % m_nHashTableSize; // see if it exists
CAssoc* pAssoc;
for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
if (pAssoc->key == key)
return pAssoc->value;
}
return NULL;
}
麻烦大虾看看是怎么回事???
{
CKGEDoc* pDoc;
CListenSocket* m_pListen;
CString strMsg;
BOOL bOk = FALSE;
UINT m_uPort;
pDoc = (CKGEDoc*)pParam;
m_uPort = pDoc->m_uPort;
m_pListen = new CListenSocket(pDoc);
if ( m_pListen )
{
pDoc->m_LogStr.Format("%u",pDoc->m_uPort);
if ( m_pListen->Create(168, SOCK_STREAM, FD_ACCEPT)) // 出错行
{
bOk = m_pListen->Listen();
}
if ( !bOk )
{
int nErr = m_pListen->GetLastError();
if ( nErr == WSAEADDRINUSE )
{
strMsg.Format(IDS_LISTEN_INUSE, pDoc->m_uPort);
}else
{
strMsg.Format(IDS_LISTEN_ERROR, pDoc->m_uPort);
}
AfxMessageBox( strMsg, MB_OK|MB_ICONSTOP );
m_pListen->Close();
delete m_pListen;
m_pListen = NULL;
}
while(true)
{
}
}else
{
AfxMessageBox( IDS_CANT_LISTEN, MB_OK|MB_ICONSTOP );
}
return 0;
}
提示错误所处的函数:void* CMapPtrToPtr::GetValueAt(void* key) const
// find value (or return NULL -- NULL values not different as a result)
{
if (m_pHashTable == NULL)
return NULL; UINT nHash = HashKey(key) % m_nHashTableSize; // see if it exists
CAssoc* pAssoc;
for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
if (pAssoc->key == key)
return pAssoc->value;
}
return NULL;
}
麻烦大虾看看是怎么回事???
用Socket API 还可以。
其实 socket 的 api 自己封装一下写成类一样很好用的
就是没有 onaccept onreceive等给你调用