我看MSDN上一个有关介绍CSocket使用的chat server的例子程序,但是我新建一个single document后,按照例子程序一模一样的建了一个CSocket派生类.但是下面的代码调用Create时总是失败,通过GetLastError取得的error值为10093,在MSDN上,查last error的最大都只有6000多,根本查不到10093 m_pSocket = new CListeningSocket(this);
if (m_pSocket->Create(800))
{
if (m_pSocket->Listen())
return TRUE;
}
else {
TRACE("error: %d\n",GetLastError());
}Loaded 'C:\WINNT\system32\ws2help.dll', no matching symbolic information found.
error: 10093
CDocument::OnNewDocument returned FALSE.请问这是为何啊???
if (m_pSocket->Create(800))
{
if (m_pSocket->Listen())
return TRUE;
}
else {
TRACE("error: %d\n",GetLastError());
}Loaded 'C:\WINNT\system32\ws2help.dll', no matching symbolic information found.
error: 10093
CDocument::OnNewDocument returned FALSE.请问这是为何啊???
AfxSocketInit()。 检查你的程序看是否已调用这个函数
BOOL *App::InitInstance()
{
if (!AfxSocketInit())
{
AfxMessageBox("应用程序没有调用 WSAStartup,或者 WSAStartup 失败");
return FALSE;
}
}