问题如下:服务器端----在CPCDApp::InitInstance()中加入了如下两行代码:
m_listensocket.Create(14875);
m_listensocket.Listen();其它代码如下:
void CListenSocket::OnAccept(int nErrorCode) 
{
CServerSocket* m_pNewClient = new CServerSocket();
ASSERT(m_pNewClient != NULL);
if (Accept(*m_pNewClient)==INVALID_SOCKET)
{MessageBox(NULL,"Á¬½Ó·¢Éú´íÎó£¡","´íÎó",MB_OK);}
CServerSocket* m_pNewClient = new CServerSocket();
ASSERT(m_pNewClient != NULL);
if (Accept(*m_pNewClient)==INVALID_SOCKET)
{MessageBox(NULL,"Á¬½Ó·¢Éú´íÎó£¡","´íÎó",MB_OK);}
CAsyncSocket::OnAccept(nErrorCode);
}void CServerSocket::OnReceive(int nErrorCode) 
{
// TODO: Add your specialized code here and/or call the base class
char szTemp[50];
  int n=Receive(szTemp,50);
  szTemp[n]=0;
  CString sTemp;
// MessageBox(NULL,"1111","2222",MB_OK);
  sTemp.Format("%s",szTemp);
CPCDView *pView = (CPCDView *)((CMainFrame *)AfxGetMainWnd())->GetActiveView();
if (sTemp=="127.0.0.1") (pView->m_left.AddString(sTemp));
CAsyncSocket::OnReceive(nErrorCode);
}void CServerSocket::OnClose(int nErrorCode) 
{
// TODO: Add your specialized code here and/or call the base class

CAsyncSocket::OnClose(nErrorCode);
}客户端-----
if (!connected)        //connected为0或1,判断是否已连接
{
m_ClientSocket.Create();
if (m_ClientSocket.GetLastError())
{
       AfxMessageBox("·þÎñÆ÷δÆô¶¯£¡");
       m_ClientSocket.Close();
   return 0;
   }
connected=1;
}
m_ClientSocket.Connect("127.0.0.1",14875);    //问题出在这一行
if (m_ClientSocket.GetLastError())
{
       AfxMessageBox("·þÎñÆ÷δÆô¶¯£¡");
       m_ClientSocket.Close();
   return 0;
   }为什么每一次运行到“m_ClientSocket.Connect("127.0.0.1",14875);”时,返回的值都为"0"呢?
 GetLastError()得到的值是10035,(sckWouldBlock 10035 套接字不成块,而指定操作将使之成块。)
我不明白是什么意思,怎么解决呢,请各位指教一下!!!